Re: Win32Lib getNameId function
- Posted by Mike777 <anon4321 at gmail?c?m> Jan 08, 2008
- 612 views
CChris wrote: > > Mike777 wrote: > > > > Using Enhanced IDE to build and run a program. Works quite nicely. Still a > > few lingering questions, though. I have a control that I attach a handler > > to > > the keypress event. I can trap for specific keys. However, some of the > > functions > > I would expect to work, don't seem to. If I attempt to get the name of the > > control by interrogating the self integer, I find that the integer is > > properly > > set but the function getIdName(self) doesn't return a sequence. The > > following > > always displays "It is empty." > > > > }}} <eucode> > > procedure myCheckBoxTest_onKeyDown (integer self, integer event, sequence > > params)--params > > is ( atom scanCode, atom shift ) > > > > integer myInteger > > > > if sequence(getIdName(self)) and length(getIdName(self)) > 0 then > > myInteger = message_box(sprintf("%s",getIdName(self)),"",0) > > elsif sequence(getIdName(self)) then > > myInteger = message_box("It is empty","",0) > > elsif integer(getIdName(self)) then > > myInteger = message_box(sprintf("%d",getIdName(self)),"",0) > > end if > > > > end procedure > > > > </eucode> {{{ > > > > Thanks > > > > Mike > > The expected behaviour is as follow: > - if the control was created on a form (not your case), then the name is the > one you supply, standardised. > - else it's the _initial_ caption, likewise. > > I didn't check what IDE does, but I suspect it creates some control with an > initial caption of "" and sets its font and text later. The name of your > control > will be "" then. Using the initial caption works splendidly. Thanks Mike