Results 1 to 15 of 15

Thread: SetParent question [Given up on :)]

  1. #1

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Resolved SetParent question [Given up on :)]

    I've placed a form inside another one using the SetParent API function. However, every time the form is clicked, the main form loses focus... Any way to avoid that?
    Last edited by Frodo_Baggins; Jun 29th, 2005 at 08:11 PM.
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: SetParent question

    What's the purpose to show another form if you don't want it to get active? Use frame or something instead ...

  3. #3

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question

    Well, yes, but techincally I've designed the forms separately... itw as just easier to stick one inside the other...
    Is there a way to give focus to two forms at a time?
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: SetParent question

    Quote Originally Posted by Frodo_Baggins
    ... Is there a way to give focus to two forms at a time?
    Nope.

  5. #5

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question

    Hm... What about toolboxes? Aren't there certain programs that have tool windows that are focused at the same time as the parent form (or does it lose focus)?
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: SetParent question

    Which "toolboxes" are you referring?

  7. #7

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question

    Hm... floating tool windows...
    dockable ones
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: SetParent question

    Those are not done in vb - I've seen many approaches but non of them really worked smoothly as expected. I suggest you drop that idea - waste of time.

  9. #9
    Addicted Member
    Join Date
    May 2005
    Posts
    168

    Re: SetParent question

    Hi,

    Frodo:

    Toolboxes dockable or otherwise lose focus look at the toolbox in VB6 IDE...focus one second then gone the next. <g>

    Have a good one!
    BK

  10. #10

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question

    Haha... alright, thanks...
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  11. #11

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question

    Quote Originally Posted by Black__Knight
    Toolboxes dockable or otherwise lose focus look at the toolbox in VB6 IDE...focus one second then gone the next. <g>
    Thanks .... Yes, I knew about VB... I just suspected other programs might have different types that don't cause the main form to lose focus...
    Well, anyways, like RhinoBull suggested, I better just transplant the entire form into a frame and merge the code with the main form...
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

  12. #12
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: SetParent question

    That sounds better.

  13. #13

  14. #14
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: SetParent question [Given up on :)]

    If you didn't want to use the "actual" MDI approach, you could try the SetWindowLong function, after you've used the SetParent API:
    VB Code:
    1. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
    2.  ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    3. Private Const GWL_STYLE = (-16)
    4. Private Const WS_CHILD = &H40000000
    5.  
    6. SetWindowLong ChildWindow.hWnd, GWL_STYLE, WS_CHILD
    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  15. #15

    Thread Starter
    Hyperactive Member Frodo_Baggins's Avatar
    Join Date
    Feb 2004
    Location
    Sao Paulo, Brazil
    Posts
    397

    Re: SetParent question [Given up on :)]

    Quote Originally Posted by MartinLiss
    Would it be OK if the focus is only lost for a moment? Or have you considered using a MDI Parent/Child relationship?
    Hum... I tried using MDI forms... but the parent form is just too limited (won't allow many controls...)
    Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width