|
-
Jun 29th, 2005, 06:46 PM
#1
Thread Starter
Hyperactive Member
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.
-
Jun 29th, 2005, 07:16 PM
#2
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 ...
-
Jun 29th, 2005, 07:22 PM
#3
Thread Starter
Hyperactive Member
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.
-
Jun 29th, 2005, 07:30 PM
#4
Re: SetParent question
 Originally Posted by Frodo_Baggins
... Is there a way to give focus to two forms at a time?
Nope.
-
Jun 29th, 2005, 07:46 PM
#5
Thread Starter
Hyperactive Member
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.
-
Jun 29th, 2005, 07:50 PM
#6
Re: SetParent question
Which "toolboxes" are you referring?
-
Jun 29th, 2005, 07:54 PM
#7
Thread Starter
Hyperactive Member
Re: SetParent question
Hm... floating tool windows...
dockable ones
Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.
-
Jun 29th, 2005, 08:01 PM
#8
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.
-
Jun 29th, 2005, 08:02 PM
#9
Addicted Member
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
-
Jun 29th, 2005, 08:03 PM
#10
Thread Starter
Hyperactive Member
Re: SetParent question
Haha... alright, thanks...
Ash Nazg durbatuluk, Ash Nazg gimbatul, Ash Nazg tharkathuluk, Agh barzum-ishi krimpatul.
-
Jun 29th, 2005, 08:05 PM
#11
Thread Starter
Hyperactive Member
Re: SetParent question
 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.
-
Jun 29th, 2005, 08:08 PM
#12
Re: SetParent question
That sounds better.
-
Jun 29th, 2005, 10:21 PM
#13
Re: SetParent question [Given up on :)]
Would it be OK if the focus is only lost for a moment? Or have you considered using a MDI Parent/Child relationship?
-
Jun 30th, 2005, 05:22 AM
#14
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:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_CHILD = &H40000000
SetWindowLong ChildWindow.hWnd, GWL_STYLE, WS_CHILD
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 30th, 2005, 09:15 AM
#15
Thread Starter
Hyperactive Member
Re: SetParent question [Given up on :)]
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|