FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Window height and width to fit on any screen resolution
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM

Window height and width to fit on any screen resolution

Posted: Mon Sep 08, 2008 05:18 AM
Friends,

What is the best way to define Screen cordinates of windows and dialogs which are more generic so that it works fine in any type of screen resolutions.

Most of the time I would like to use the max.area of the screen.

For my Main Window (MDI) I have used the following code so that My App's window runs in Full screen without hiding my Win XP Start Button Bar.

Code used

nScrHeight:=GetSysMetrics(1)  // Screen Height
nScrWidth :=GetSysMetrics(0)  // Screen Width
DEFINE WINDOW oWnd FROM 0, 0 TO nScrHeight, nScrWidth MDI;
      TITLE "Accounting Software" ;
      MENU  BuildMenu() 

DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007 
     
SET MESSAGE OF oWnd TO " " 2007
DEFINE MSGITEM OF oWnd:oMsgBar PROMPT alltrim(mCoName) SIZE 220  // Company Name

ACTIVATE WINDOW oWnd MAXIMIZED;
	  ON INIT Select_Co();
      VALID MsgYesNo( "Do you want to quit this application ?","Quit Accounting Software")


The above code is giving me the desired output

Right now I am not using any Resource editors to define windows and dialogs. I plan to use resorce editors only from my 2nd project on FWH,
This is my 1st project and at this moment I have to get familiar with FWH.

Now I want to define a MDICHILD window with it's top starting just below from the Button Bar. With the follwoing code (ie If I don't specify the Window cordinate From 0,0 to 21,30 ) the top and top left is absolutely ok. But height and width is the problem.

I want my MDI Child Window's :-

1) Height (Bottom Border) to be just above the MsgBar of my Main MDI Window, so that it will not hide the MsgBar.

2) Width should be near to the right border of my main MDI window.

Is there any general way to acheive this so that my app's windows look the same on any PC with any type of Screen Resolution.

Regards

Anser
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Dialog - Size

Posted: Mon Sep 08, 2008 08:05 AM
Hello,

You can calculate the Dialog-position in relation to the Window

// MDI window without the MDI Menue

DEFINE WINDOW oWnd TITLE "Test" MDI MENU TMenu():New() 

..
..

SET MESSAGE OF oWnd TO "Test" ;
CENTERED CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWnd MAXIMIZED ;
VALID MsgYesNo( "Do you want to end?" )

// --------------------------

FUNCTION TestDialog(oWnd)
local oDlg

// Define the Dialog @ 20, 30  .... or from resources.

DEFINE DIALOG oDlg RESOURCE "Dialog" OF oWnd TITLE  "Test" FONT oFont

....
....
....

// Show the Dialog on a defined position.
// 30, 10 => is the top / left - position of the dialog inside the MDI -Window.

ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT oDlg:Move( 30 , 10, oDlg:nWidth, oDlg:nHeight, .f. )

RETURN NIL


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion