Page 1 of 1

problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 2:29 pm
by noorderling
With a lot of open windows in a mdi gadget I want to prevent opening windows twice by bringing the allready open window to the front but it seems setactivewindow does not work within a mdi gadget? Selecting the window menu-entry works so there must be a way?
I understand that I cannot steal focus from other applications but I am inside my own application here.

Found that stickywindow also does not work inside a mdi gadget?

anyone ideas?

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 2:37 pm
by IdeasVacuum
Have you tried something like SetWindowPos_(hWnd, #HWND_TOP,iXposn,iYposn,iWidth,iHeight,#SWP_NOMOVE | #SWP_NOSIZE)?

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 2:54 pm
by noorderling
no, but tnx to your remark I tried BringWindowToTop_. That works. Rather use puer PB, but than again .. as long as it gets the job done.

so problem solved.

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 4:09 pm
by Edwin Knoppert
It's a message since this a 'system' on the MDIClient windowclass.

WM_MDIACTIVATE

http://msdn.microsoft.com/en-us/library ... S.85).aspx

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 7:07 pm
by netmaestro
You're going about it wrong. Purebasic actually comes with a (little-used) manual:
PB doc for SetGadgetState[b] wrote:- MDIGadget(): Change the currently focused childwindow (by giving the related #Window number), or use one of the following values: [/b]

#PB_MDI_Cascade : Cascade the child windows
#PB_MDI_TileVertically : Tile the childwindows vertically
#PB_MDI_TileHorizontally: Tile the childwindows horizontally
#PB_MDI_Next : Give focus to the next childwindow
#PB_MDI_Previous : Give focus to the previous childwindow
#PB_MDI_Arrange : Arrange the iconic (minimized) windows

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 7:28 pm
by Edwin Knoppert
Can be and i went over there but i can't make head or tail about just activating the MDIform.
Next and such comes close but not specific.

Re: problem with setactivewindow in mdi gadget

Posted: Sat Jul 31, 2010 7:34 pm
by netmaestro
So to set a specific MDIChild to the front and focused you would:

Code: Select all

SetGadgetState(#mdigadget, #mdichild_<whichever>)
Or, optionally you could use one of the listed parameters to rearrange them all.

Re: problem with setactivewindow in mdi gadget

Posted: Sun Aug 01, 2010 10:41 am
by noorderling
netmaestro wrote:So to set a specific MDIChild to the front and focused you would:

Code: Select all

SetGadgetState(#mdigadget, #mdichild_<whichever>)
Or, optionally you could use one of the listed parameters to rearrange them all.
Far more elegant. Tnx