Menu

#971 pushbutton is not working

v4.1
closed
ooDialog (58)
5
2012-08-14
2010-12-23
No

in rc file: pushbutton with id other than 1 or 2 is not working,
but all examples (including id other than 1 or 2) do work
os: windowsXP/windows7
version: 4.1.0.6441
(I am an oorexx newby: but a lot of experience with mainframe rexx.

Discussion

  • Angel Hoogkamer

    Angel Hoogkamer - 2010-12-23
     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-24

    I'm going to close this as invalid, but I'm also attaching some files to show you what you need to do.

    In order for a push button to work, you have to add a method in your dialog that "does something" when the button is pushed. And, you have to add an event connection between your method and the button ID.

    The Ok and Cancel buttons are a special case. In Windows, it is standard that the Ok button has an ID of 1 and Cancel has an ID of 2. For the Ok button and Cancel button, the ooDialog framework has already added the Ok and Cancel methods to the base dialog and connected those two methods to the IDs of 1 and 2. That's why those buttons work in your program.

    Your 'Tulp' button does not work because A.) you did not connect the ID of 3 to any method in your dialog, and B.) you did not supply a method to begin with.

    I'm attaching 4 files: test7-orig.rc, test7-orig.rex, test7-improved.rex, and test7-improved.rc

    test7.orig.rex has the bare minimum you need to get your button to work. Please look up the following things in the ooDialog documentation.

    1.) The load() method has an optional argument that allows you to connect the buttons in the rc file automatically. You load() method should look like this:

    if dlg~Load("test7-orig.rc", 100, "CONNECTBUTTONS") \= 0 then exit

    2.) The ooDialog framework provides a number of base classes for dialogs. But, you can not do anything with the base classes, so instantiating one of those classes will not help you much. You need to create your own subclass of one of the base classes, to anything.

    In your program you want to subclass PlainUserDialog, not instantiate it directly. Add this class definition to subclass the PlainUserDialog:

    ::class 'TulpDialog' subclass PlainUserDialog

    Then instantiate your TulpDialog, not PlainUserDialog:

    dlg = .TulpDialog~new

    3.) Finally in the TulpDialog you have to provide a method that does something when your button is pushed. Add this method to the TulpDialog:

    ::method tulp
    say "The 'Tulp' button was pushed."

    The test7-orig.rex and test7-orig.rc files demonstrate this.


    There are a couple of other things I would do right off the bat with your program. The *-improved files show this.

    1.) Since you are using a .rc file, you should subclass the RcDialog class rather than the PlainUserDialog. That way you do not need to use the load method at all.

    2.) Many of the lower number IDs for controls already have conventional meanings. I would always start my resource IDs at 100 and work up. This changed is reflected in the test7-improved.rc file.

    3.) The deinstall() method does nothing, I would remove it.

    4.) infordialog() returns a value that gets treated as a command to the external environment. But '0' is not a command recognized by the extenal environment. I would either assign the return to a variable, or use: call infordialog() instead.

    Pleas try looking at the oodialog docs where there is a lot of explanation on how things work in ooDialgo.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-24

    Example program

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-24

    Example program

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-24

    Example program

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-24

    Example program

     

Anonymous
Anonymous

Add attachments
Cancel