1. Win32Lib getNameId function
- Posted by Mike777 <anon4321 at gm?i?.com> Jan 07, 2008
- 685 views
- Last edited Jan 08, 2008
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."
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
Thanks Mike
2. Re: Win32Lib getNameId function
- Posted by CChris <christian.cuvier at ?gricultu?e.gouv.fr> Jan 08, 2008
- 649 views
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. CChris
3. Re: Win32Lib getNameId function
- Posted by Judith Evans <camping at ?cewb?net> Jan 08, 2008
- 635 views
- Last edited Jan 09, 2008
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." > > > > 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. > > CChris Nope. The caption is initially the Name of the control. User may change the caption of course. judith evans
4. Re: Win32Lib getNameId function
- Posted by Mike777 <anon4321 at gmail?c?m> Jan 08, 2008
- 632 views
- Last edited Jan 09, 2008
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