Windowtype modal,child,panel....difference ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
ILKNUR
Posts: 24
Joined: Thu Apr 22, 2010 7:16 am
Location: Istanbul- Turkey

Windowtype modal,child,panel....difference ?

Post by ILKNUR »

Hi,

I search and look at the documents but cant see. Sorry if I missed it :(

I want to learn the difference of the windowtypes.

modal, child,panel,standard a little bit confused...

who would like to explain ?
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Windowtype modal,child,panel....difference ?

Post by dhaine_adp »

Ilknur,

If you never did a program for windows before perhaps it's a little bit confusing at first. However, please also consider reviewing the samples that comes along with the HMG distribution. The documentation that comes along with the HMG is more on the syntax of the command. The samples demonstrate the controls capability. As you can probably perceived, samples codes are the best alternative in the absence of manual.

In compiling the samples you need to do that in console or modify the contents of the compile.bat that you find on the folder. Insert the name of the prg file. Example:

call ..\..\build.bat %*

simply insert this:

call ..\..\build.bat demo %* (and save the file, then double click it).

Also look at the folder "C:\hmg\SAMPLES\MAIN.DEMO", it showcase the HMG controls.

In HMG there is only one MAIN window and the rest are child window. For panel window please see the example on "C:\hmg\SAMPLES\PANEL.1", there are three code examples.

Back to the main and child window, the child window contains the orphaned windows. Example (non working, for demo only of principles involved):

Code: Select all

#include "minigui.ch"
#include "inkey.ch"
#include "common.ch"

REQUEST DBFCDX, DBFFPT


******************
function Main()

   ANNOUNCE RDDSYS
   SET FIXED ON
   SET DECIMALS TO 2
   SET MULTIPLE OFF WARNING
   SET DATE AMERICAN
   SET CENTURY ON
   SET EPOCH TO 1950
   SET WRAP ON
   SET SCOREBOARD OFF
   SET DELETED ON
   SET CONFIRM ON
   SET BELL ON
   SET FONT TO "Verdana" , 9
   SET NAVIGATION EXTENDED
   SET BROWSESYNC ON
   SET TOOLTIPSTYLE BALLOON
   SET TOOLTIPBACKCOLOR { 255 , 255 , 255 }
   SET TOOLTIPFORECOLOR { 0 , 0 , 0 }
   RDDSETDEFAULT("DBFCDX")

   DEFINE WINDOW MainForm;
      AT 0,0;
      WIDTH 548 HEIGHT 378;
      TITLE " " + ProductName() ;
      ICON "myicon";
      MAIN;
      FONT "Tahoma" SIZE 10;
      ON INIT ( MakeFile(), BeginLogon() );
      ON RELEASE NIL;
      ON INTERACTIVECLOSE DestroyWindow()
   END WINDOW
 
   MainForm.Center()
   MainForm.Minimize()

	DEFINE WINDOW frmSplash;
		AT 0,0;
		WIDTH 400 HEIGHT 260;
		TITLE "";
		TOPMOST NOCAPTION;
		ON INIT NIL ;
		ON RELEASE MainForm.Maximize()
		@ 0,0 IMAGE imgSplash OF frmSplash PICTURE ImageHome + "daleaid.sys" WIDTH 400 HEIGHT 260
	END WINDOW
   frmSplash.Center()

   ACTIVATE WINDOW frmSplash, MainForm
      
   DestroyWindow()
   RETURN NIL



// Example of Child //

   DEFINE WINDOW frmGenBrowse;
      AT 0,0;
      WIDTH 730 HEIGHT 540;
      TITLE "Sample Only";
      ICON "myicon";
      NOMINIMIZE NOMAXIMIZE NOSIZE;
      FONT "Arial" SIZE 9 ON RELEASE NIL;
      ON INTERACTIVECLOSE NIL

   END WINDOW
   frmGenBrowse.Center
   frmGenBrowse.Activate
     
   RETURN NIL


// Another Child //
   DEFINE WINDOW frmGenBrowse;
      AT 0,0;
      WIDTH 730 HEIGHT 540;
      TITLE "Sample Only";
      ICON "myicon";
      CHILD;
      NOMINIMIZE NOMAXIMIZE NOSIZE;
      FONT "Arial" SIZE 9 ON RELEASE NIL;
      ON INTERACTIVECLOSE NIL

   END WINDOW
   frmGenBrowse.Center
   frmGenBrowse.Activate
   
   RETURN NIL

The difference between the two child window samples above is that when you minimized the window, the first declaration groups on the taskbar as part of window group of the application. The last one minimize not to the task bar but in the main window. In the task bar you only see the main window application.

Modal window is a type of window that stays on top of other windows at all times. It is a persistent window. You can use it to generate a window for users log on screen. Users are not able to put modal window in background. Please compile the samples and the main demo so that you can see its basic application. The other is for users input validation. So your program halts for a while until the user reacted to the contents of the modal window.

The best way to learn HMG is thru the samples provided by Roberto. Then create your own simple apps by adding main menu, action to menu items and branching out. Start with a simple one. If you run into trouble that you cannot resolved by yourself, then try posting the error or upload a subset of your code into the forum under HMG Help. Described your problem so that other members can review your code. But then it is also a fact that some questions are not answered most especially if none of the members has no idea about the nature of the problem.

Regards,

Danny
Regards,

Danny
Manila, Philippines
ILKNUR
Posts: 24
Joined: Thu Apr 22, 2010 7:16 am
Location: Istanbul- Turkey

Re: Windowtype modal,child,panel....difference ?

Post by ILKNUR »

Danny ,

thanks for reply . I always look samples , and trying new things. But some how , ı couldnt fit the windows types in my mind .

especially modal and child. I see differences that you write but think that (i dont know why... :oops: ) there are more differences that i cant see..

thanks again for your patience and sharing..
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: Windowtype modal,child,panel....difference ?

Post by l3whmg »

Hi Ilknur, this is a very brief explanation:

- MAIN window: this is a mandatory window type and consider it as the main window of your project.
- MODAL form: you must complete every operations with this form. From this form you can open another MODAL form, but you can't open CHILD/STANDARD form; when this form is active, you can't select anything from the MAIN form.
- CHILD/STANDARD from: you can open other forms (CHILD/STANDARD/MODAL) and you can activate function from MAIN form (menu); but make sure the proper use, when necessary, of instructions ISWINDOWDEFINED (or _ISWINDOWDEFINED) and ISWINDOWACTIVE (or _ISWINDOWACTIVE). There are some difference between CHILD and STANDARD: you can look in your task bar when used.

These are, roughly, the main differences in their use.

Best regards.
Luigi from Italy
www.L3W.it
ILKNUR
Posts: 24
Joined: Thu Apr 22, 2010 7:16 am
Location: Istanbul- Turkey

Re: Windowtype modal,child,panel....difference ?

Post by ILKNUR »

hi l3whmg ,

As you said , It is really a brief explanation .
and also excellent .

thanks a lot. :)
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: Windowtype modal,child,panel....difference ?

Post by l3whmg »

Hi Ilknur,
I'm enjoy to know it was usefull. I suggest to you, to best understand differences and use, to create simple program with all form types together. For example:
- MAIN program, MAIN form, MAIN menu functions: callPgm01, callPgm03, callPgm05.
- Pgm01: define/activate a MODAL form with action (menu or button) callPgm02
- Pgm02: define/activate a MODAL form
- Pgm03: define/activate a STANDARD form with action (menu or button) callPgm04
- Pgm04: define/activate a STANDARD form
- Pgm05: define/activate a CHILD form with action (menu or button) callPgm06
- Pgm06: define/activate a CHILD form
...and you can mix call.

At this point you can observe their functionality ...and som crash :lol: because you must pay attention to the combination...and when a form is alive or die.

Best regards and Happy New Year.
Luigi
Luigi from Italy
www.L3W.it
ILKNUR
Posts: 24
Joined: Thu Apr 22, 2010 7:16 am
Location: Istanbul- Turkey

Re: Windowtype modal,child,panel....difference ?

Post by ILKNUR »

Hi l3whmg,

Sorry for late reply. :(

It is nice of you.
Yes ,I have already tried little samples and see the results as crash ;) and running :)

Happy new year.
Post Reply