attaching a window to a window..
BlitzPlus Forums/BlitzPlus Programming/attaching a window to a window..| 
 | ||
| Hi guys. Is there any way to attach a "window to a window" in B+? I'm trying to create a "drop down" style menu bar that will be located about halfway down a client window. It will be borderless and just contain a series of drop down menus. The position on the client window is important and it must move with the client window if the user moves it. I've tried creating a "panel" object and placing menu items in it, but it doesn't seem to work. Any ideas? Thx... | 
| 
 | ||
| Can't you put the code to reposition the client window in the "window move/resize" event? | 
| 
 | ||
| Possibly. I think the "menu window" would "lag" on the screen when the client was moved.. I'd like it to appear to the user that the "menu window" is integral with the the client window. I'll try it tho'...thx for the suggestion. I found this older thread: http://www.blitzbasic.com/bbs/posts.php?topic=17953 which is more along the lines I'm thinking of. (I think) The "menu window" behaves more like a panel object that moves with the parent window... | 
| 
 | ||
| Nope it doesn't lag. I have used this in an application. Just use GadgetX(window) gadgetY(window), with the WindowMove event. | 
| 
 | ||
| Thx. Hmm, I must be a bit thick-headed today. I've looked through the docs and haven't located a description of the WindowMove event... | 
| 
 | ||
| $801 | 
| 
 | ||
| Thx for the help guys. I think it'll work fine... | 
| 
 | ||
| @skn3[ac] Could you post a code snippet? I've been messing about with getting the "window in a window" attachment working and I'm just banging my head... Either it doesn't move or it lags... thx! | 
| 
 | ||
| Code below on my machine does not lag. Hope that helps 
Global ParentWin    = CreateWindow("Parent",200,200,200,200,0,1)
Global ChildWin = CreateWindow("Child",100,200,100,100,ParentWin,17)
Global OldX=GadgetX(ParentWin)
Global OldY=GadgetY(ParentWin)
Repeat
	Select WaitEvent()
		Case $801 ; Win move
			Select EventSource()
				Case ParentWin
					NewX=EventX()
					NewY=EventY()
					
					MoveX=NewX-OldX
					MoveY=NewY-OldY
					
					OldX=NewX
					OldY=NewY
					
					SetGadgetShape(ChildWin,GadgetX(ChildWin)+MoveX,GadgetY(ChildWin)+MoveY,GadgetWidth(ChildWin),GadgetHeight(ChildWin))
			End Select
			
		Case $803 ; Win close
			End
			
	End Select
Forever
 | 
| 
 | ||
| Thx! I found my problem by studying your example... It works perfectly now. |