Re: [Gnoga-list] Obtaining the current Window
Is there any concern that I could be taking the access of a Window_Type object that is local to another function (I assume the On_Connect)? I know it is a tagged type so it is passed by reference, but I don't know the lifetime of the item I am passing the reference from.If I am in my own On_Connect handler, I think I should be ok, but talking about other events (like button clicks) where I get the connection data and access it. On Sun, Dec 13, 2015 at 3:06 PM, Rabbi David Bottonwrote: > Since you can have multiple connections you need to store an access to the > Windows object in the On_Connect. It would not be possible to have that in > a global object. So that is not kludgy, but the best way to do it. > > David Botton > > > On Sun, Dec 13, 2015 at 1:41 PM Jeremiah Breeden < > jeremiah.bree...@gmail.com> wrote: > >> Is there a good way to get control of the window object for a >> connection? One work around I am experimenting with is adding a window >> access parameter to my app_data type, but this feels a bit kludgy and I am >> not sure how safe that is long term. >> >> I don't always have global or local access to the Window (like when in an >> event handler in a separate package). >> >> -- >> ___ >> Gnoga-list mailing list >> Gnoga-list@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gnoga-list >> > > > -- > > ___ > Gnoga-list mailing list > Gnoga-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gnoga-list > > -- ___ Gnoga-list mailing list Gnoga-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnoga-list
Re: [Gnoga-list] Obtaining the current Window
As long as the On_Connect has not returned the Window reference returned should be legal. You should get any new events once the Window reference is no longer legal either. It would be wise though to consider during an event that the window reference could go bad. If you want to be defensive and not rely on an attempt to dereference a dead Window reference throwing an exception you can either check any object on the same connection with Object.Valid if false than most likely the Window reference is bad or will become bad soon, the other method is to use Connection.Hold at the end of your On_Connect and in the line after that set some flag in your per connection data to indicate the connection has died. David Botton On Mon, Dec 14, 2015 at 7:28 PM Jeremiah Breedenwrote: > Is there any concern that I could be taking the access of a Window_Type > object that is local to another function (I assume the On_Connect)? I know > it is a tagged type so it is passed by reference, but I don't know the > lifetime of the item I am passing the reference from.If I am in my own > On_Connect handler, I think I should be ok, but talking about other events > (like button clicks) where I get the connection data and access it. > > On Sun, Dec 13, 2015 at 3:06 PM, Rabbi David Botton > wrote: > >> Since you can have multiple connections you need to store an access to >> the Windows object in the On_Connect. It would not be possible to have that >> in a global object. So that is not kludgy, but the best way to do it. >> >> David Botton >> >> >> On Sun, Dec 13, 2015 at 1:41 PM Jeremiah Breeden < >> jeremiah.bree...@gmail.com> wrote: >> >>> Is there a good way to get control of the window object for a >>> connection? One work around I am experimenting with is adding a window >>> access parameter to my app_data type, but this feels a bit kludgy and I am >>> not sure how safe that is long term. >>> >>> I don't always have global or local access to the Window (like when in >>> an event handler in a separate package). >>> >>> -- >>> ___ >>> Gnoga-list mailing list >>> Gnoga-list@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/gnoga-list >>> >> >> >> -- >> >> ___ >> Gnoga-list mailing list >> Gnoga-list@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gnoga-list >> >> > > -- > ___ > Gnoga-list mailing list > Gnoga-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gnoga-list > -- ___ Gnoga-list mailing list Gnoga-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnoga-list
Re: [Gnoga-list] Obtaining the current Window
Since you can have multiple connections you need to store an access to the Windows object in the On_Connect. It would not be possible to have that in a global object. So that is not kludgy, but the best way to do it. David Botton On Sun, Dec 13, 2015 at 1:41 PM Jeremiah Breedenwrote: > Is there a good way to get control of the window object for a connection? > One work around I am experimenting with is adding a window access parameter > to my app_data type, but this feels a bit kludgy and I am not sure how safe > that is long term. > > I don't always have global or local access to the Window (like when in an > event handler in a separate package). > > -- > ___ > Gnoga-list mailing list > Gnoga-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gnoga-list > -- ___ Gnoga-list mailing list Gnoga-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnoga-list