Window height and width to fit on any screen resolution

Window height and width to fit on any screen resolution

Postby anserkk » Mon Sep 08, 2008 5: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

Code: Select all  Expand view  RUN
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
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Dialog - Size

Postby ukoenig » Mon Sep 08, 2008 8:05 am

Hello,

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

Code: Select all  Expand view  RUN

// 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests