Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27

Thread: form as dialog panel?

  1. #11
    Senior Member
    Join Date
    Oct 2012
    Posts
    207

    Exclamation I found something ...

    define class mykeres as container
    add object browin as container
    add object getwin as container
    enddefine

    define class keresablak as form
    add object kerwin as mykeres custom
    enddefine



    my_form1 = createobject("keresablak")
    my_panel1 = my_form1.kerwin.getwin

    ? type("my_panel1") // "O"
    my_panel1.addobject("buttons","commandgroup")
    my_panel1.buttons.buttoncount = 2

    ?type("my_form1.kerwin.getwin") //"O"

    kerwin = createobject("mykeres")
    my_form2 = createobject("form")
    my_form2.addobject(kerwin)
    my_panel2 = my_form2.kerwin.getwin

    ? type("my_panel2") // "O"
    my_panel2.addobject("buttons","commandgroup")
    my_panel2.buttons.buttoncount = 2

    ?type("my_form2.kerwin.getwin") //"O"


    kerwin = myfunc()
    my_form3 = createobject("form")
    my_form3.addobject(kerwin)

    ? type("my_form3.kerwin.getwin") //"U" !!!!!!!!!!!!!!!!!!


    function myfunc
    private mycont
    mycont = createobject("mykeres")
    myget = mycont.getwin
    myget.addobject('buttons',"commandgroup")
    myget.buttons.buttoncount = 2
    return mycont

  2. #12
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,236
    What confused me is you use the term dialog panel when it's just a form you are trying to create.

    A dialog panel slides in using Lianja.showDialogPanel()
    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

  3. #13
    Senior Member
    Join Date
    Oct 2012
    Posts
    207
    you are right Barry, that is my goal. But I wanted to test it. The panel for this would be a container, which is part of a form in the test. However, the container would be independent of the form, with event handlers running in the container. Control events would be bound to these handlers.
    The problem is, on the one hand, I can't bind certain events (e.g. commandbutton.click, textbox.keypress, grid.click, etc.)
    On the other hand, the problem is that the container event handler does not "see" some container members (eg the address of the embedded grid - from browse - can only be passed as a global variable, and at this moment I think that's true for any member which is not part of the defined class , but added with addobject method)
    thank you for your attention!

  4. #14
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,236
    You can't use addobject(ovar) and expect the member name to remain the same. add object(ovar) is for adding anonymous objects.

    You need to use

    my_form3.addobject("kerwin", "mykeres")


    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. #15
    Senior Member
    Join Date
    Oct 2012
    Posts
    207
    thank you Barry! I undertood this, but there is something else wrong (too), unfortunately i don't understand what...
    I managed to do the form based "dialog box" (event handlers are the form object's methods) but I can't implement the container based solution.
    Bindevents() also works, the problem is that even if I type in a textbox, the keypress event doesn't fire. Even if I click on any button in a commandgroup, the click event does not fire.
    If I enter a raiseevent() command via cli, the event is handled with the appropriate binding.
    thanks again: S

  6. #16
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,236
    I need to see a cut down version of your code.
    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

  7. #17
    Senior Member
    Join Date
    Oct 2012
    Posts
    207
    excuse me Barry , I really don't know what "cut down version" means, so I attached my test prg
    thank you very much for your help
    Attached Files Attached Files

  8. #18
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,236
    Firstly you don’t need to use READ EVENTS. yourform.show(1) is used for a modal dialog.

    Is there any reason you are using bindevents() rather than just declare the event handlers as part of your classes?

    I would also recommend you close off the procedure definitions with endproc and function definitions with endfunc.
    Last edited by barrymavin; 2020-09-24 at 15:13.
    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

  9. #19
    Senior Member
    Join Date
    Oct 2012
    Posts
    207

    many thanks!
    I wasn’t sure it's allowed to (re)define events in own classes

  10. #20
    Senior Member
    Join Date
    Oct 2012
    Posts
    207
    event definitions would work, but the indicated events (textbox.keypress, commandgroup.button (). click, grid.rightclick) would not arm, even when using form.schow (1). Is it possible to enable events somehow?
    I don't know how to define commandgroup.button events (proc click () parameters btn didn't work) and grid events either.

    Can I handle a grid pointer only in a global variable? I tried to pass an object property:
    ? oGrid
    Object (refcnt = 5)
    (
    )
    oBj.prop = oGrid
    ? obj.prop
    Object (refcnt = 0)
    (
    [OGRID] => Object (refcnt = 0)
    (
    )
    )

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