1. Win32Lib getNameId function

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

new topic     » topic index » view message » categorize

2. Re: Win32Lib getNameId function

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib getNameId function

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Lib getNameId function

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu