How I can get parent window name ?

Moderator: Rathinagiri

Post Reply
fugazi
Posts: 21
Joined: Thu Jun 16, 2011 10:58 am
Has thanked: 1 time

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: 2286
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 347 times
Been thanked: 61 times
Contact:

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: 17
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF
Has thanked: 2 times
Been thanked: 3 times

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: 17
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF
Has thanked: 2 times
Been thanked: 3 times

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: 862
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 129 times
Been thanked: 218 times

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: 267
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 8 times
Been thanked: 37 times

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: 17
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF
Has thanked: 2 times
Been thanked: 3 times

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 13 times

User avatar
bpd2000
Posts: 1143
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 241 times
Been thanked: 139 times

Post by bpd2000 »

BPD
Convert Dream into Reality through HMG

Post Reply