Page 1 of 1
How I can get parent window name ?
Posted: Mon Mar 11, 2013 3:29 pm
by fugazi
I use one function in many places in many windows. And need know parent window name something like ThisWindow.name
Could somebody help me.
Regards
Fugazi
Re: How I can get parent window name ?
Posted: Mon Mar 11, 2013 3:54 pm
by danielmaximiliano
Try
Parent Property :
Specifies the parent window name for a GUI object
Syntax: Parent <ParentWindowName>
Re: How I can get parent window name ?
Posted: Sun Jun 07, 2020 3:53 am
by vlademiro
Hi all
danielmaximiliano wrote: ↑Mon Mar 11, 2013 3:54 pm
Try
Parent Property :
Specifies the parent window name for a GUI object
Syntax: Parent <ParentWindowName>
This code define a parent window to my control.
I wish get parent window name in my generic function.
Like this in Javascript
Code: Select all
// Open a new window
var myWindow = window.open("", "myWindow", "width=200, height=100");
// Write some text in the new window
myWindow.document.write("<p>This is 'myWindow'</p>");
// Write some text in the window that created the new window
myWindow.opener.document.write("<p>This is the source window!</p>");
In Javascript, the "opener" word replace this parent window name.
How to do this in HMG ?
Thanks all.
Re: How I can get parent window name ?
Posted: Sun Jun 07, 2020 4:10 am
by vlademiro
I found this solution.
Before open my window in generic function, get actual window name
Code: Select all
Function Search()
Local cParent := ThisWindow.Name // <<<<------ Get window name before open new window
Load Window Search
blah blah blah blah
Re: How I can get parent window name ?
Posted: Sun Jun 07, 2020 8:04 am
by AUGE_OHR
hi,
Java Script is OOP Style.
when use Function i recommend to use Parameter
Code: Select all
Search( ThisWindow.Name )
Function Search(cWindowName)
Re: How I can get parent window name ?
Posted: Sun Jun 07, 2020 9:43 am
by trmpluym
You can use:
Code: Select all
Function ShowParentName()
LOCAL hWnd := GetActiveWindow(), hWndParent := GetParent(hWnd), cWindowName
GetFormNameByHandle (hWndParent, @cWindowName)
MsgDebug(cWindowName)
Return (cWindowName)
Theo
Re: How I can get parent window name ?
Posted: Tue Jun 09, 2020 7:06 pm
by vlademiro
Thanks Theo, this function works perfectly.
This conditions below must be true:
(1) This function must be called after window activate (not only window load)
(2) Window type must be CHILD, not STANDARD.
See little example attached
Re: How I can get parent window name ?
Posted: Wed Jun 10, 2020 4:25 am
by bpd2000