problem with setactivewindow in mdi gadget

Windows specific forum
noorderling
User
User
Posts: 16
Joined: Fri Jul 16, 2010 3:54 pm

problem with setactivewindow in mdi gadget

Post 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?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: problem with setactivewindow in mdi gadget

Post by IdeasVacuum »

Have you tried something like SetWindowPos_(hWnd, #HWND_TOP,iXposn,iYposn,iWidth,iHeight,#SWP_NOMOVE | #SWP_NOSIZE)?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
noorderling
User
User
Posts: 16
Joined: Fri Jul 16, 2010 3:54 pm

Re: problem with setactivewindow in mdi gadget

Post 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.
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Re: problem with setactivewindow in mdi gadget

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: problem with setactivewindow in mdi gadget

Post 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
BERESHEIT
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Re: problem with setactivewindow in mdi gadget

Post 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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: problem with setactivewindow in mdi gadget

Post 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.
BERESHEIT
noorderling
User
User
Posts: 16
Joined: Fri Jul 16, 2010 3:54 pm

Re: problem with setactivewindow in mdi gadget

Post 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
Post Reply