Hi everyone - I figured I would broaden my audience on this forum topic from earlier today. Does anyone happen to have windows Declares to attach a window to a parent window so when you move the parent window the child window moves with it? Its what Christian has for OS X NSWindowMBS.AddChildWindow().
Update on SetParent - It was an easy declare to make, but it didn’t glue the child to the parent.
What do you normally do when Win32API calls for an array (Integer Type) but we can’t pass that to an external function using a declare (I get this message and I’m new to declares on Win32API)?
Type: const HWND*
An array of handles to the child windows to arrange. If a specified child window is a top-level window with the style WS_EX_TOPMOST or WS_EX_TOOLWINDOW , the child window is not arranged. If this parameter is NULL , all child windows of the specified parent window (or of the desktop window) are arranged.
Oh no need Eugene – I was saying that i answered my own question by reading your Declare book!
To pass an array to an external source you need to create a memory block and pass it as a pointer Thank you for writing that book! Now getting that function to work is my next challenge
Hope you are doing well @eugenedakin
Chuckle, Norm, you soooo know how this works I can’t tell you how many times I have been asked a ‘rush’ question that quickly suffers from scope creep.
Its good - I can’t see the forest for the trees - literally
Google maps says that I am near the Alberta Saskatchewan border, about 1.5 hours from nowhere… chuckle… I just have to make sure that my truck is full of fuel and my power cords can charge my portable equipment. Roads? I don’t need any roads where I am … lol…
The View code is in ChildWindow.Open and the controller code is in the WindowsAPI module.
// SET PARENT OF THIS WINDOW TO MAIN WINDOW
Var setParentResultInt as Integer = WindowsAPI.setParent(Self.Handle, ParentWindow.Handle)
// SET CHILD BIT ON WINDOW STYLE
Var childStyle as Integer = WS_CHILDWINDOW
Var setWinStyleResultInt as Integer = WindowsAPI.SetWindowLong(Self.Handle, GWL_STYLE, childStyle)
// SET BORDER AROUND CHILD WINDOW
Var borderStyle as Integer = WS_BORDER
Var borderResultInt as Integer = WindowsAPI.SetWindowLong(Self.Handle, GWL_STYLE, borderStyle)
// SET CHILD X/Y POS VARIABLES
Var newXpos as Integer = (ParentWindow.Width/2 - self.Width/2)
Var newYpos as Integer = (ParentWindow.Height/2 - self.Height/2)
Var newW as Integer = Self.Width
Var newH as Integer = Self.Height
Var moveWinResultInt as Integer = WindowsAPI.MoveWindow(Self.Handle, newXpos, newYpos, newW, newH, True)
// UPDATE PARENT
Var updateWinResultInt as Integer = WindowsAPI.UpdateWindow(ParentWindow.Handle)