The current application we are working on contains numerous forms with controls that may or may not have OPTIONS functionality associated with them. I would like to be able to display a label in the bottom of the form when a control that has OPTIONS functionality has focus. Does anyone know of a good way to accomplish this? Thanks.
Yes,
My application is doing this for any control that has the GOTFOCUS event.
Basically, I have a global application GOTFOCUS event ( APPLICATIONNAME*GOTFOCUS* ) that checks if the respective control has a quickevent or a script defined for it. If so it puts up a message. Also, the first time a control gets focus in a window, all controls that have options defined, along with a white background have their background color turned a light beige. This gives the entire application a very consistent look with no extra work.
The only caveat is that there are controls that do not issue a GOTFOCUS so there it would be your decision how to handle them.
I hope this is the idea that you were after.
Dave
Dave,
Thanks for the tip. What property do you use to tell if a control has a QuickEvent or a script associated with it?
Greg
Here's the relevant piece of code that identifies the controls that have OPTIONS. If you need more help, e-mail me at [email protected]
EntID=@appid:"*OIWIN":(@window1,'F*') WinID=@appid:"":(@window1,'F*')
Events=get(@window,"@EVENTS")
if Events=' then
w=XLATE("SYSREPOSWINS" , WinID , '' , 'X')w=field(w , @rm , 3)num_li=fieldcount(w , @fm )q='for i=1 to num_lilocate "OPTIONS" in w using @svm setting pos thenq=@appid:"*OIEVENT*OPTIONS*":(@window1,'F*'):".":wendnext iEvents=Repository("GETSUB",EntID)if Events # '' thenEvents := @fmEvents := qend elseEvents=qend= set(@window,"@EVENTS",Events)num_events =count(Events,@fm) + (Events # '')for i=1 to num_eventsType=field(Events[i],'*',3)if Type _EQC "Options" thenControlID=field(Events[i],'*',4)ControlID=@window:".":field(ControlID, '.' , 2)endnext iend
Enjoy!
Hi Greg,
Dave gave you a pretty thorough piece of code that can provide a lot of information. If you are looking for a quick way to tell if a control has an OPTIONS event, the following is what we use:
Events=Get_Property(CtrlEntId, "ORIG_STRUCT") If Index(Events, "OPTIONS*", 1) then /* Control has an OPTIONS event */ end else /* Control does not have an OPTIONS event */ end
Don,
The reason why I use that code is so I can identify all the controls with Options the first time a window is started (and GOTFOCUS fired) and change their backcolor. I also store those control ids in an @ property of the window at that time and look in there afterwards.
But you are 100% correct: if all there's needed is a "This control has options" message when the control gets FOCUS, then your code is definitely the one to use.
[email protected] onmouseover=window.status=email greg james;return(true)"