Developing windows forms applications 
Author Message
 Developing windows forms applications

Now that I have started using the forms in J a bit more seriously
I have found it a bit tedious to remember what verbs are connected
to what object and event on the form.

In order to make that a bit easier on myself I have found that
adding these two lines

else.
wdinfo 1{ >,}."1 wdq

to wdhandler can make a huge difference
in understanding what is going on.

It is always possible to have a verbs in the form scripts called
<formname>_handler
or
<formname>_default
to take care of unexpected events but I prefer to handle the event
in expected verbs.

With these two new lines in wdhandler if an unexpected verb is detected
then wdinfo displays its name in a popup window.

All I have to do then is add a verb with that name in the script and
next time around that event will trigger that verb and my operations
take over.

The form edit creates verbs for you but once you have left the safe
haven of the laboratory the script will be changed in notepad or some
other editor and something uncontrolled can start to happen.

I post the wdhandler here with my changes to it for those of you who
like to take advantage of his change.

--------

  wdhandler=: 3 : 0
wdq=: wd 'q'
val=. {:"1 wdq
ndx=. 1 i.~ 3 = 4!:0 [ 3{.val
if. 3>ndx do.
  nms=. {."1 wdq
  (nms)=: val
  fn=. >ndx{val
  try. fn~0
  catch.
    err=. LF,,LF,.}.;._2 [ 13!:12''
    wdinfo 'wdhandler';'error in: ',fn,err
  end.
  4!:55 nms
else.
wdinfo 1{ >,}."1 wdq
end.
empty''
)

--

http://www.*-*-*.com/ ~gosi
http://www.*-*-*.com/



Sat, 19 Sep 1998 03:00:00 GMT  
 Developing windows forms applications

Quote:
>Now that I have started using the forms in J a bit more seriously
>I have found it a bit tedious to remember what verbs are connected
>to what object and event on the form.

>In order to make that a bit easier on myself I have found that
>adding these two lines

>else.
>wdinfo 1{ >,}."1 wdq

>to wdhandler can make a huge difference
>in understanding what is going on.

>It is always possible to have a verbs in the form scripts called
><formname>_handler
>or
><formname>_default
>to take care of unexpected events but I prefer to handle the event
>in expected verbs.

 Having "unconnected" events pop up something like a message box
is a good idea when developing a form -- I think I'll do that.
I don't believe I understand why you don't use the <formname>_default
handler to do it though.

 When an event occurs in a particular form, <wdhandler> calls the
*first* verb in the following list which has been defined to handle
the event:

   formname_handler   - Rarely defined; this is a hook at the front
                        of the chain to allow an application to get
                        complete control of all events without defining
                        individual verbs.

   formname_controlname_eventname - The usual mechanism.  The particular
                        verb to handle an event for a control, if defined,
                        is called.

   formname_default   - A verb to catch any events that "fall through"
                        the above two levels.

 An example:

   NB. Creates a top-level form <f> with two buttons, <b1> and <b2>:
   wd 'pc f;cc b1 button;xywh 50 -1 -1 -1;cc b2 button;pas 0 0;ptop;pshow'

   NB. Define the button event for b1 in f to put up a message box:
   f_b1_button=. wd bind 'mb "Button" "B1 pressed"'

 Now, pressing button1 causes f_b1_button to run, but when button2
is hit, the wdhandler doesn't call any verb.  We can now define
the default handler for the form to catch these events:
   f_default=. wdqshow    NB. wdqshow displays event info in a messagebox.

 Now, pressing button2 causes wdqshow to run.

   wd 'reset'   NB. Close it all up when you're done experimenting.

 I hope this would do what you want without having to having to alter
wdhandler.

--



Sat, 19 Sep 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Developing windows forms applications

2. "Developing Clarion for Windows Applications"

3. Compilers developing Windows applications ?

4. Developing Windows Application

5. Developing Database Applications in Smalltalk

6. How to develop multi dll and multi dictionary application

7. "Developing Visual Programming Applications Using Smalltalk"

8. Help for developing C++ database application (Sigh!!!)

9. developing web enabled applications with Labview 6.0

10. developing A DMM Custom GUI application

11. Develop new clipper applications ??

12. we develop your Labview-application (german company)

 

 
Powered by phpBB® Forum Software