Results 1 to 10 of 10

Thread: How to get the value of an optiongroup?

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    121

    How to get the value of an optiongroup?

    I've imported a VFP Form (scx/sct). There are (among others) Checkboxes and an Optiongroup. I declared the ControlSource variables as public. After I released the Form the values of the Checkboxes are altered according my clicks but NOT the value of the Optiongroup!
    How could I get it?

    Here is an imported code snippet:

    * File created by Lianja Version 4.2
    * Converted on 11/14/2018 at 14:57:07
    ////////////////////////////////////////////////////////////////////////////////
    define class optiongroup1_5cb0s8plw as optiongroup

    ** Properties
    ButtonCount = 5
    Value = 1

    // The public "welche" has everytime the value which it had before the form ("beginning value")
    ControlSource = "welche"

    Height = 121
    Left = 64
    Top = 36
    Width = 212
    Name = "Optiongroup1"
    Option1.Caption = "Diakone"
    Option1.Value = 1
    Option1.Height = 17
    Option1.Left = 5
    Option1.Top = 5
    Option1.Width = 64
    //Option1.AutoSize = .T.
    Option1.Name = "Option1"
    Option2.Caption = "Pastoralreferenten"
    Option2.Value = 2
    Option2.Height = 17
    Option2.Left = 5
    Option2.Top = 27
    Option2.Width = 120
    //Option2.AutoSize = .T.
    Option2.Name = "Option2"
    Option3.Caption = "Gemeindereferenten"
    Option3.Value = 3
    Option3.Height = 17
    Option3.Left = 5
    Option3.Top = 50
    Option3.Width = 132

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,099
    I've tried your case as custom section, adding the click event to show optiongroup's value:

    Code:
    //// Lianja custom section for page "page1" section "section1"
    //
    namespace f4395
    define class page1_section1 as section
    enddefine
    
    
    define class optiongroup1_5cb0s8plw as optiongroup
    
    
    ** Properties
    ButtonCount = 5
    Value = 1
    
    
    // The public "welche" has everytime the value which it had before the form ("beginning value")
    ControlSource = "welche"
    caption='OptionGroup'
    Height = 121
    Left = 64
    Top = 36
    Width = 212
    Name = "Optiongroup1"
    Option1.Caption = "Diakone"
    Option1.Value = 1
    Option1.Height = 17
    Option1.Left = 5
    Option1.Top = 5
    Option1.Width = 64
    //Option1.AutoSize = .T.
    Option1.Name = "Option1"
    Option2.Caption = "Pastoralreferenten"
    Option2.Value = 2
    Option2.Height = 17
    Option2.Left = 5
    Option2.Top = 27
    Option2.Width = 120
    //Option2.AutoSize = .T.
    Option2.Name = "Option2"
    Option3.Caption = "Gemeindereferenten"
    Option3.Value = 3    
    Option3.Height = 17
    Option3.Left = 5
    Option3.Top = 50
    Option3.Width = 132
    
    
    proc click
        messagebox(transform(value))    
    endproc
    
    
    enddefine
    
    
    proc page1_section1 
        page1_section1 = createobject("page1_section1")
    
    
        page1_section1.addobject("opg", "optiongroup1_5cb0s8plw")
    return page1_section1
    The Click shows correct value of the optiongroup.
    Last edited by josipradnik; 2018-11-14 at 11:55.

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    121
    Thank you Josip !

    It seems your click proc works inside the optiongroup, everytime you click an option.

    My form with the optiongroup (and other items) is indside a webview (.rsp).
    So, for further code actions, I need the results if the form is released.
    No problem with checkboxes or text fields, but with the optiongroup...

    How could I send you the whole rsp file?

    Georg

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    The doc for the optiongroup can be found at the link below and the click delegate is mentioned.
    https://www.lianja.com/doc/index.php/Optiongroup
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    121
    Thank you, Barry,
    I knew this link.
    My problem is to get a value of the optiongroup after .show(1) , means if I released the form.
    The form is part of an .rsp file (webview)

  6. #6
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,099
    Hi Georg,

    How do you get values of checkboxes after .show(1) ?
    Using _SESSION and getsessionvar() ?

    Josip

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    If I understand correctly you have embedded a WebView in a form/dialog and you want to get the values from controls in the WebView.

    The WebView class has an evaluate() method which allows to to call a JavaScript function that you have generated by your rsp code.

    Is this a desktop or a web app?

    Also note that there is a beforeclose and an afterclose event.
    https://www.lianja.com/doc/index.php/Form
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  8. #8
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    121
    Hi Josip,

    I attached a zip file to answer your question about how I refer to the values of my checkboxes.
    Simple: I use public vars and refer to these vars if the form is closed.

    Sorry it is not so easy with optiongroup values.
    But your solution to add a click proc into the optiongroup is fine, and in this click proc I can assign the optiongroup value to my public var.

    Maybe I could do it also - as Barry mentioned - in a beforeclose and an afterclose event.

    My next problem: How could I deploy my example to the web? I can not achive it :-(

    Thank you!
    Georg
    I hope you can get my zip file... the attach procedure is a little bit strange to me...
    Attached Files Attached Files

  9. #9
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,099
    Hi Georg,

    I worked on your zip.
    Created app with the same name and copied your files from zip into it's folder.
    I renamed the app into gcjm_optiongroup_test.app.
    Then added a class optiongroup as in initial post and in click method I used "this.value",
    assigning it to a global variable according to your approach.
    It works.

    Here I am attaching the LPK file (Lianja package) named gcjm_optiongroup_test (making packages is an option in Deploy workspace).

    Please download it. In Lianja close your app.
    In Apps workspace you need to chose "Install package" icon from above, find my LPK-file in your downloads, and my app will be installed on your PC.

    Josip

    gcjm_optiongroup_test.lpk
    Last edited by josipradnik; 2018-11-16 at 04:38.

  10. #10
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    121
    Dobar dan, Josip !

    Thank you for checking and expand my little app with the optiongroup.

    But sorry, I cannot use it as a WebApp because of the error "CLASS 'OPTIONGROUP' not found".

    In the meantime, I solved my problem with a canvas section with a combobox.
    It seems I'm pretty silly ;-)

    Lijepo nedjelje!

    Georg

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us