Re: Previous control

new topic     » goto parent     » topic index » view thread      » older message » newer message

Mike777 wrote:
> 
> I have two separate top-level windows.  I want window 2 to be aware of what
> the last control that was touched on window 1 was.  Is there an easy way for
> a command button on window2 to interrogate "something" and find out what
> control
> has the focus on window1?
> 
> The reason I'm asking is that the controls are being built with newUIObj and
> therefore they depend on user input at the time.  
> 
> I have been successful at registering a callback for check boxes and radio
> buttons,
> but I have not been able to make a callback work for other controls (edit
> boxes
> and combo boxes, mostly).
> 
> If I could make the callback work for all controls that can have focus, I
> would
> have no problem manipulating a global variable for inter-window communication.
> 
> So, either way would work for me (1: make the callback work for edit and combo
> boxes; 2: find some other way to send information (or retrieve information)).
> 
> Here is my code for the callback that works for check boxes and radio buttons:
> 
> global procedure MyCheckClick (integer self, integer event, sequence params)
>     -- previousCheckBox is a global variable, so I always know what the last
>     -- checkbox (or radio button) that was clicked was
>     previousCheckBox = self
> end procedure
> 
> procedure AppCallback(integer self, integer event, sequence params)
> sequence mySeq
> mySeq = getIdName(self)
> -- All of my checkboxes have names that begin with "chk"
> -- All of my radioboxes have names that begin with "opt"
> if event = w32HGetHandler and
>   compare("Click",params[1][1..5]) = 0 and
>      ((compare(mySeq[1..3],"chk") = 0)
>          or (compare(mySeq[1..3],"opt") = 0)) then
>   returnValue(routine_id("MyCheckClick"))      	
> end if
> end procedure
> prevValue = setCallback(routine_id("AppCallback"))
> 
> I suppose the edit boxes and combo boxes don't really have a Click event, so
> I'm supposed to use a different event for w32HGetHandler.  
> 
> Any guidance would be appreciated.
> 
> Thanks
> 
> Mike

Why not simply add an w32HGotFocus event handler to all the controls you are
interested in?
The common handler would save in a variable you define the id of the control for
which it is called (or stack them if you need more), and then you retrieve them.
Doesn't work?

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu