Mark,

Thanks for this answer. The clouds are lifting.

But I still don't understand it all, even though I've read the sections of
ooDialog Reference that you pointed out. I've been trying to understand the
relationship between:
(a) a control (e.g. an Edit control)
(b) the data value placed in that control (e.g. the string "ABC123")
(c) dlgData as in the third param of the following line of code:
    dlg = .ProductView~new("ProductView.rc", IDD_PRODUCT_VIEW, dlgData.,
"ProductView.h")

I have the impression that using auto-detect is meant to make things easier
for the programmer. But I can't see this. So I built two exceedingly simple
dialog programs (atatched) to check things out. And I'm still confused. 

I guess the first question is this: am I supposed to be able to use the
third param directly myself as a programmer? I assumed "yes". So, I have a
.h file with an edit control with id 1002. Suppose I want to populate this
with the data "ABC123"? 
How would I do this? 
I tried in the initDialog method with no success. And also in an event
handler method (for a pushbutton). 
In both, I did:
  dlgdata.DATA1002 = "ABC1002"
In both, the interpreter said dlgData was a string, not a stem variable.

One other thing - when the "data attributes" of a dialog are mentioned, it
doesn't seem to mean the same thing as an attribute (::ATTRIBUTE) of a
class. Is that right?

Btw, another question is, when I omit the third param (dlgData), how do I
populate an edit control with its initial data?

When I get all this straight, I hope to use both approaches in the Guide to
explain the differences. 

Many thanks,
Oliver

PS: The ResDlg program is mainly used at the moment to check out the
over-writing of my data in a class that omits the third parameter - I made
it a ResDialog class just for the heck of it. With a judiciously-placed
SysSleep, I can now see my data disappearing!



-----Original Message-----
From: Mark Miesfeld [mailto:miesf...@gmail.com]
Sent: 27 May 2011 14:25
To: Open Object Rexx Users
Subject: Re: [Oorexx-users] ooDialog - setText does not seem to set text the
first time.

On Thu, May 26, 2011 at 6:00 PM, Mark Miesfeld <miesf...@gmail.com> wrote:
> On Thu, May 26, 2011 at 4:41 PM,  <os...@simsassociates.co.uk> wrote:
>
>> Using ResDialog, I cannot initially display data in an edit control. 
>> The test I ran to try to isolate the problem is as follows:
>  ...
>> I have two identical programs, except that one uses RcDialog while 
>> the other uses ResDialog.
>
> I would expect the same problem to exist in the RcDialog.

Although the programs are similar, they are not identical.  In the program
for the RcDialog, you use this for the new() method:

  dlg = .ProductView~new("ProductView.rc", IDD_PRODUCT_VIEW, dlgData.,
"ProductView.h")

and in the program for the ResDialog you use this:

  dlg = .ProductView~new("ProductView.dll", IDD_PRODUCT_VIEW, ,
"ProductView.h")

So, in the Rc dialog you supply the 3rd dialog data stem argument, and in
the Res dialog, you omit that 3rd argument.

If you either use the argument in both programs, or omit the argument in
both programs, they will behave exactly the same.

When you use the argument, after initDialog() is executed, the ooDialog
framework will use the stem to set the values of the dialog controls and
will not use the data attributes to set the controls.
But, since you never initialized the stem, there are no controls to set.
This is why you see the text that you set with:

    prodNo = self~newEdit("IDC_PROD_NO")
    r = prodNo~settext("ABC123")

When you omit the argument, after initDialog() finishes, ooDialog sets the
edit control to the value of its data attribute, which is the empty string.

This behavior is now documented in section "3.2.1 new (Class method)"
the new method of the dialog object.  If you read that and the
"Understanding data attributes" section, it should be perfectly clear.
 <grin>

This was a good topic, it is an area that can be very confusing.

--
Mark miesfeld

----------------------------------------------------------------------------
--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, you get
blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Attachment: dlg.h
Description: Binary data

Attachment: dlg.rc
Description: Binary data

Attachment: RcDlg.rex
Description: Binary data

Attachment: ResDlg.rex
Description: Binary data

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to