How I can get parent window name ?

Moderator: Rathinagiri

Post Reply
fugazi
Posts: 23
Joined: Thu Jun 16, 2011 10:58 am

How I can get parent window name ?

Post 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
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: How I can get parent window name ?

Post by danielmaximiliano »

Try
Parent Property :
Specifies the parent window name for a GUI object

Syntax: Parent <ParentWindowName>
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
vlademiro
Posts: 36
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF

Re: How I can get parent window name ?

Post 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.
vlademiro
Posts: 36
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF

Re: How I can get parent window name ?

Post 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

User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: How I can get parent window name ?

Post 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)
have fun
Jimmy
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: How I can get parent window name ?

Post 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
vlademiro
Posts: 36
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF

Re: How I can get parent window name ?

Post 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
App21_GetParent.zip
(2.6 KiB) Downloaded 165 times
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: How I can get parent window name ?

Post by bpd2000 »

BPD
Convert Dream into Reality through HMG
Post Reply