On Thu, Aug 11, 2011 at 7:59 AM, Oliver Sims <
oliver.s...@simsassociates.co.uk> wrote:

> **
> In the defineDialog method of a UserDialog program (listed below), I have
> the following statement:
>
>   self~createStaticText(902, 40, 40, 200, 40, , "ABC")
>
> But the text "ABC" does not appear. Is this a bug?
>

I'm going to kind of hedge on my answer.  Is this a bug?  Not really, it's
our old friend autodetection.

Add:


::method initAutoDetection
  self~noAutoDetection


>  If I now change the createStaticText() statement to:
>
>    self~createStaticText(, 40, 40, 200, 40, , "ABC")
>
> then the text "ABC" does appear, but of course the program breaks at the
> ~newStatic(902) statement.
>
> Btw, this program used to work fine a couple of months ago.
>


I made a change a little while ago, to fix another bug I think.

Static controls were ignored in the original auto detection code.  But, they
should only be ignored if they have a resource ID of -1.  If they are
assigned an ID, then they should be treated by the auto detection code the
same way as an edit control.  For backwards compatibility, I probably need
to revisit why I made the change and the implementation of the change.

So, in your code, when you assign an ID, auto detection sets the text to ""
since you did not set the attribute.  When you don't assign an ID, then auto
detection ignores the control.

You could also add this code:

dlg = .MyDialog2~new
dlg~data902 = 'ABC'
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
and skip the initAutoDetection() override and it will work.

All in all, I think the confusion auto detection causes negates the idea
that it makes things simplier for the Rexx program.

Here's a small program that shows why a static text control should be
treated the same as an edit control.  If the programmer *wants* to use auto
detection, then it should behave consistently in all cases:

say 'Please enter your name:'
parse pull name

dlg = .MyDialog2~new
dlg~data902 = 'Hello' name
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)

::requires "ooDialog.cls"

::CLASS 'MyDialog2' SUBCLASS UserDialog

::METHOD init
  forward class (super) continue
  self~create(30, 30, 257, 123, "Test Dialog", "CENTER")

::METHOD defineDialog
  self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "PushMe",
PushMeClicked)
  self~createStaticText(902, 40, 40, 200, 40, , "ABC")

::METHOD PushMeClicked
  newText = self~newStatic(902)
  say "Change your name to:"
  parse pull name
  newText~setText("Hello" name)

--
Mark Miesfeld
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to