OODialog - SetEntryLine doesn't display data

Help
2010-10-04
2012-08-14
  • Anthony Carter

    Anthony Carter - 2010-10-04

    This is part of a simple dialog

    ::method defineDialog

    self~addEntryLine(27, , 345, 32, 100, 10, "AUTOSCROLLH")

    ::method InitDialog

    time_date = time('l') date('n')

    self~SetEntryLine(27, time_date) / now display the date /

    rubbish = self~GetEntryLine(27)

    The data is not displayed in field 27

    Yet when I use trace i I can see that "rubbish" is set to the value. So what
    do I need to do to display the value in field 27 - please/thanks

     
  • Mark Harsen

    Mark Harsen - 2010-10-04

    Try using self~setValue(27, time_date). It works for me. Good luck, -Mark

     
  • Anthony Carter

    Anthony Carter - 2010-10-04

    I had alreay tried that - but Tried again - no luck - I am using oorexx 4.01
    on win32 xp machine and I do have an

    ::method init

    expose useriddata2. ..... .

    use arg useriddata2., ....

    ret = self~init:super

    if ret = 0 then do

    self~ConnectButton(300, "Store_Test_Information") / connect button Update
    with a method
    /

    self~ConnectButton(200, "Get_Platform_Data") / connect button IDGETPLATFORM
    with a method
    /

    self~ConnectList(31, "ListSelected")

    end

    where .... is a lot of stem refs.

     
  • Mark Harsen

    Mark Harsen - 2010-10-04

    I guess I don't know... I'm using REXX 4.01 on 32/64 bits which work equally
    well. My similar code worked the first time, then I added code to change the
    font and wound up with the following:

    Self~AddEntryLine(98, "DefEdit", 344, 424, 446, 168, "AUTOSCROLLV MULTILINE
    VSCROLL HIDESELECTION HIDDEN").

    .

    .

    Self~~showItem(98)~hideItem(99)

    DefInputFontHandle = Self~createFontEx("Arial", 14)

    Self~setValue(98, RefreshText~changestr("\n", '0d0a'x))

    EditControl = Self~getEditControl(98)

    EditControl~setColor(7, Black)

    Self~SetItemFont(98, DefInputFontHandle, 1)

    .

    .

    .

    I didn't have to refresh the field, screen or anything. I'm sorry I don't know
    why it's notworking for you. -Mark

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-10-04

    Most likely the cause of the problem is data auto detection.

    Add this to your program:

    ::method initAutoDetection

    self~noAutoDetection

    and things will work.

    Data auto detection will set the values of dialog controls to either the
    matching data attribute's value, or to the value of a data stem passed to the
    init() method of the UserDialog class.

    You are not passing in a data stem:

    ret = self~init:super

    and you are not automatically creating a data attribute:

    self~addEntryLine(27, , 345, 32, 100, 10, "AUTOSCROLLH")

    (the second argument is omitted.)

    What happens is, after initDialog() has executed, when autodetection is on,
    the ooDialog framework sets the values of all the dialog controls. Since there
    is no data stem, and no data attribute for the edit control with ID of 27, it
    gets set to the empty string.

    I don't like data autodetection because: it is difficult for people to
    understand, it was never documented well, and a lot of it happens under the
    covers in the ooDialog framework making programs harder to understand.

    Basically you could fix this in one of 3 ways.

    1.) Turn autodetection off. The suggestion above.

    2.) Use a data stem. You init() method could be:

    ::method init

    expose useriddata2. ..... .

    use arg useriddata2., ....

    dataStem.27 = time('l') date('n')

    ret = self~init:super(dataStem.)

    if ret = 0 then do

    self~ConnectButton(300, "Store_Test_Information") / connect button Update
    with a method
    /

    self~ConnectButton(200, "Get_Platform_Data") / connect button IDGETPLATFORM
    with a method
    /

    self~ConnectList(31, "ListSelected")

    end

    The above works as you expect. Be sure and do NOT use the initAutoDetection
    method I showed

    3.) Create a data attribute for the entry line and set its value. This would
    work (if there is no initAutoDetection()) method:

    ::method defineDialog

    self~addEntryLine(27, 'editValue', 345, 32, 100, 10, "AUTOSCROLLH")

    self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")

    self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")

    self~editValue = time('l') date('n')

     
  • Anthony Carter

    Anthony Carter - 2010-10-04

    Thanks I used your 3rd option this worked for me.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-10-04

    Just a note to any one reading this thread. In this example I gave:

    ::method defineDialog

    self~addEntryLine(27, 'editValue', 345, 32, 100, 10, "AUTOSCROLLH")

    self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")

    self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")

    self~editValue = time('l') date('n')

    createPushButton() is method that is not available in any release version of
    ooDialog, it will be in a future release. For ooDialog 4.1.0 and prior you
    would need to use the addButton() method.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks