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?
Printable View
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?
What's the purpose to show another form if you don't want it to get active? Use frame or something instead ...
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?
Nope.Quote:
Originally Posted by Frodo_Baggins
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)?
Which "toolboxes" are you referring?
Hm... floating tool windows...
dockable ones
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.
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
Haha... alright, thanks...
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...Quote:
Originally Posted by Black__Knight
Well, anyways, like RhinoBull suggested, I better just transplant the entire form into a frame and merge the code with the main form...
That sounds better. ;) :wave:
Would it be OK if the focus is only lost for a moment? Or have you considered using a MDI Parent/Child relationship?
If you didn't want to use the "actual" MDI approach, you could try the SetWindowLong function, after you've used the SetParent API:
chemVB 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
Hum... I tried using MDI forms... but the parent form is just too limited (won't allow many controls...)Quote:
Originally Posted by MartinLiss