Announcement

Collapse
No announcement yet.

hParent question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • hParent question

    I am not sure I understand the importance of hParent in relation to it's parent dialog. If I create a main dialog like this,

    DIALOG NEW hParent,"Main",0,0,100,100 TO firstDlg

    and then create a secondary dialog which is called from the 'Main' dialog like this,

    DIALOG NEW firstDlg,"Secondary",0,0,100,100 TO secondDlg

    What is the value of firstDlg to the secondary dialog. It is not available to the secondary dialog without making it a global or am I missing something.

    David Hoff Jr

  • #2
    What is the value of firstDlg to the secondary dialog. It is not available to the secondary
    dialog without making it a global or am I missing something.
    [/quote]
    It changes the relationship between the two dialogs. The second dialog is owned by the first
    dialog and will always appear above its owner(the first dialog).

    The handle of the owner is obtained as follows:
    Code:
    firstDlg = GetWindow(secondDlg, %GW_OWNER)
    or

    Code:
    firstDlg = GetParent(secondDlg)
    or

    Code:
    firstDlg = GetWindowLong(secondDlg, %GWL_HWNDPARENT)
    GetWindow will always return the handle of the owner window or null. GetParent and GetWindowLong
    return the handle of the parent, or the owner, or null depending on the window styles(WS_XXX) of the
    window being checked.
    Dominic Mitchell
    Member
    Last edited by Dominic Mitchell; 13 Oct 2009, 08:36 PM.
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

    Comment


    • #3
      hParent will automatically be disabled when used as the owner of a modal dialog, and made available again only when the modal dialog has been dismissed.

      That's the easy way to force the user to stay off one screen until he has completed work on another. It's kind of like a "two screen wizard."
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment

      Working...
      X