Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » zApp Developers
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Thu Mar 17, 2005 6:43 pm   

Events, keyup in particular
 
I don't see the events of zApp objects listed in the docs under the section of the controls, Edit for example. I'm probably looking in the wrong place.

I'm trying to catch a keyup event on the Edit control. The event seems to accept two arguments, as I expected (if you write a sub accepting only one, you get an error message when it fires telling you that zApp tried to pass 2).

I can't figure out the type of the second argument, though. A typeof() in the script returns "Object", and unlike the Sender argument it doesn't seem to have a default property.

The example below shows a few of the tries I've made- it will give a succession of error messages as the various accesses fail (reading what's currently in the textbox succeeds, but doesn't help because I'm trying to catch the Enter key and that doesn't seem to put CRLF on the end of the text).

Mar 15 build of zApp.

-Tarn

Code:

<window name="main">
<edit name="test"></edit>
<script>
test.text = "hello world"
sub test_OnKeyUp(Sender,whichkey)
on error resume next
   msgbox "KeyUp fired",1
   msgbox "current contents of textbox:" &amp; sender,1
   if err.number <> 0 then
      msgbox "retrieval of text failed" &amp; err.number,1
      err.clear
   end if
   msgbox "whichkey?:" &amp; whichkey,1
   if err.number <> 0 then
      msgbox "direct use failed",1
      err.clear
   end if
   msgbox "whichkey?:" &amp; cstr(whichkey),1
   if err.number <> 0 then
      msgbox "conversion to string failed",1
      err.clear
   end if
   msgbox "whichkey?:" &amp; clng(whichkey),1
   if err.number <> 0 then
      msgbox "conversion to long failed",1
      err.clear
   end if
end sub
</script>
</window>
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Mar 17, 2005 7:00 pm   
 
I haven't documented the events yet because they are greatly in flux with the changeover to the DevExpress controls.

But basically, *every* event only has two parameters. The first parameter is the object that triggered the event. The second argument is a general "Params" argument which then has subproperties dependant upon the specific event. So, without documentation of the second argument, which will be different for every event, there isn't much you'll be able to do.

In the Keyup case, take a look at the CALC.ZML demo program. It has an OnKeyDown event and you'll see it access the second argument to get the key that was pressed. The OnKeyUp event uses the same arguments.
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Thu Mar 17, 2005 7:05 pm   
 
Quick answer for others who might have the same question:
Code:
sub test_OnKeyUp(Sender,whichkey)
     msgbox whichkey.key
end sub
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » zApp Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net