DEFINE WINDOW properties

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

DEFINE WINDOW properties

Post by bpd2000 »

Hi
We have DEFINE WINDOW properties like ThisWindow.Handle --> nFormHandle

But how to define / create properties like ThisWindow.Name --> cFormName
BPD
Convert Dream into Reality through HMG
edk
Posts: 911
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: DEFINE WINDOW properties

Post by edk »

Sorry but I do not understand.
Semi-OOP object ThisWindow.Name does exist. You can with the object ThisWindow.<Property/MethodName> use any method or property associated with the form.
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: DEFINE WINDOW properties

Post by bpd2000 »

Hi
You are correct that Semi-OOP object ThisWindow.Name does exist.
I would like to know what is the form name of opened/focused window
We can create such OOP style to get Form name easily
BPD
Convert Dream into Reality through HMG
edk
Posts: 911
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: DEFINE WINDOW properties

Post by edk »

Do you mean something like this?:

Code: Select all

#include "hmg.ch"

#xtranslate FocusedWindow . <p:Title,NotifyIcon,NotifyTooltip,FocusedControl,Name,Row,Col,Width,Height> => GetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex )  , <"p"> )
#xtranslate FocusedWindow . <p:Title,Cursor,NotifyIcon,NotifyTooltip,Row,Col,Width,Height> := <arg> => SetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> , <arg> )
#xtranslate FocusedWindow . <p:Activate,Center,Redraw,CenterDesktop,Release,Maximize,Minimize,Restore,Show,Hide,SetFocus> [ () ] => DoMethod ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> )
#xtranslate FocusedWindow . <p:CenterIn> (\<arg\>) => DoMethod ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , \<"p"\> , \<"arg"\> )
#xtranslate FocusedWindow . <p:HANDLE,INDEX,IsMinimized,IsMaximized,ClientAreaWidth,ClientAreaHeight> => GetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> )
#xtranslate FocusedWindow . <p:NoClose,NoCaption,NoMaximize,NoMinimize,NoSize,NoSysMenu,HScroll,VScroll,Enabled> => GetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> )
#xtranslate FocusedWindow . <p:NoClose,NoCaption,NoMaximize,NoMinimize,NoSize,NoSysMenu,HScroll,VScroll,Enabled> := <arg> => SetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> , <arg> )
#xtranslate FocusedWindow . <p:AlphaBlendTransparent,BackColorTransparent> := <arg> => SetProperty ( GetFormNameByIndex( _HMG_LastActiveFormIndex ) , <"p"> , <arg> )

Function Main

	DEFINE WINDOW Win_1 ;
		ROW 0 ;
		COL 0 ;
		WIDTH 350 ;
		HEIGHT 150 ;
		TITLE 'Win 1' ;
		WINDOWTYPE MAIN  
		 
		DEFINE BUTTON B_1
		ROW     10
		COL     10
		WIDTH   90
		HEIGHT  28
		CAPTION ""
		ACTION  Nil
		END BUTTON

		DEFINE STATUSBAR FONT 'Verdana' SIZE 7
		STATUSITEM "" 
		END STATUSBAR

		DEFINE TIMER Timer_1 ;
		INTERVAL 100 ;
		ACTION getFocusedForm() 

	END WINDOW

	DEFINE WINDOW Win_2 ;
		ROW 150 ;
		COL 150 ;
		WIDTH 350 ;
		HEIGHT 150 ;
		TITLE 'Win 2'  
	END WINDOW

	DEFINE WINDOW Win_3 ;
		ROW 300 ;
		COL 300 ;
		WIDTH 350 ;
		HEIGHT 150 ;
		TITLE 'Win 3'  
	END WINDOW

	DEFINE WINDOW Win_4 ;
		ROW 450 ;
		COL 450 ;
		WIDTH 350 ;
		HEIGHT 150 ;
		TITLE 'Win 4'  
	END WINDOW

	Activate Window Win_1, Win_2, Win_3, Win_4 

Return
***************************************************************************
Function getFocusedForm()

Win_1.StatusBar.Item(1) := "FocusedWindow.Name=" + FocusedWindow.Name + " , ThisWindow.Name=" + ThisWindow.Name
Win_1.B_1.Caption := FocusedWindow.Title

Return
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: DEFINE WINDOW properties

Post by bpd2000 »

Thank you Edward
Exactly what I needed
It will also useful to other user also
BPD
Convert Dream into Reality through HMG
Post Reply