Open modal window before the main window

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Contact:

Open modal window before the main window

Post by pctoledo »

How to open modal window before the main window?

I tried that, but it did not work:

Code: Select all

#include "hmg.ch"

Function Main

Local oMainWindow

	With Object oMainWindow := Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 400
		:Height		:= 200
		:Title		:= 'System Demo'
		:Type		:= WND_MAIN
		:OnInit		:= { || Password_(), oMainWindow:Maximize() }
		:OnRelease	:= { || Close_Win() }

	End With

	oMainWindow:Activate()

Return

Function Password_()
Local oModalPass, oButton1

	With Object oModalPass	:= Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 200
		:Height		:= 100
		:Title		:= 'Password'
		:Type		:= WND_MODAL
		:OnInit		:= { || ( oModalPass:Center() ) } 

		With Object oButton1 := Button():New()
			:Row		:= 40
			:Col		:= 40
			:Caption	:= 'Close Window Password'
			:OnClick	:= { || oModalPass:Release() }
		End With

	End With

	oModalPass:Activate()

return .T.

Function Close_Win()
Local oModalClose, oButton2

	With Object oModalClose	:= Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 200
		:Height		:= 100
		:Title		:= 'Close System'
		:Type		:= WND_MODAL
		:OnInit		:= { || ( oModalClose:Center() ) } 

		With Object oButton2 := Button():New()
			:Row		:= 40
			:Col		:= 40
			:Caption	:= 'Close System'
			:OnClick	:= { || oModalClose:Release() }
		End With

	End With

	oModalClose:Activate()

return .T.
I wanted to open a window Password before the main window. And when you finish the main window, open another modal window.
Regards/Saludos,

Toledo

Clipper On Line
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Open modal window before the main window

Post by Rathinagiri »

pctoledo wrote:How to open modal window before the main window?

I tried that, but it did not work:

Code: Select all

#include "hmg.ch"

Function Main

Local oMainWindow

	With Object oMainWindow := Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 400
		:Height		:= 200
		:Title		:= 'System Demo'
		:Type		:= WND_MAIN
		:OnInit		:= { || Password_(), oMainWindow:Maximize() }
		:OnRelease	:= { || Close_Win() }

	End With

	oMainWindow:Activate()

Return

Function Password_()
Local oModalPass, oButton1

	With Object oModalPass	:= Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 200
		:Height		:= 100
		:Title		:= 'Password'
		:Type		:= WND_MODAL
		:OnInit		:= { || ( oModalPass:Center() ) } 

		With Object oButton1 := Button():New()
			:Row		:= 40
			:Col		:= 40
			:Caption	:= 'Close Window Password'
			:OnClick	:= { || oModalPass:Release() }
		End With

	End With

	oModalPass:Activate()

return .T.

Function Close_Win()
Local oModalClose, oButton2

	With Object oModalClose	:= Window():New()
		:Row		:= 10
		:Col		:= 10
		:Width		:= 200
		:Height		:= 100
		:Title		:= 'Close System'
		:Type		:= WND_MODAL
		:OnInit		:= { || ( oModalClose:Center() ) } 

		With Object oButton2 := Button():New()
			:Row		:= 40
			:Col		:= 40
			:Caption	:= 'Close System'
			:OnClick	:= { || oModalClose:Release() }
		End With

	End With

	oModalClose:Activate()

return .T.
I wanted to open a window Password before the main window. And when you finish the main window, open another modal window.
You can open the main window with 'noshow' clause. So, the modal window will be shown to the user first. From the modal window, you can show or close the main window as the case may be.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Contact:

Re: Open modal window before the main window

Post by pctoledo »

rathinagiri wrote:You can open the main window with 'noshow' clause.
Hi Rathinagiri, thanks for the help, but in my example, how can I use the noshow clause?

Code: Select all

With Object oMainWindow := Window():New()
   :Row      := 10
   :Col      := 10
   :Width      := 400
   :Height      := 200
   :Title      := 'System Demo'
   :Type      := WND_MAIN
   :OnInit      := { || Password_(), oMainWindow:Maximize() }
   :OnRelease   := { || Close_Win() }

End With
Another question, in lines 868 and 896 of the file hmg.ch has:

[:Visible := <.lVisible.> ] ;; //line 868
[:Visible := !<.lNoVisible.> ] ;; //line 896

This is correct?
Regards/Saludos,

Toledo

Clipper On Line
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Open modal window before the main window

Post by Rathinagiri »

I am sorry, I was talking about HMG3. :(

Let me see how to do this in HMG4 too.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply