Resizing of Browse

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
CCH4CLIPPER
Posts: 130
Joined: Tue Mar 03, 2009 8:59 am
Been thanked: 1 time

Resizing of Browse

Post by CCH4CLIPPER »

Hi Escigi/Kathinagiri and all HMG Gurus

What must I do to make a BROWSE expand automatically when one maximise a window.
In Delphi, most visual controls have an ALIGN CLIENT property. I cannot find a similar property for BROWSE

Any help will be appreciated.


CCH
http://cch4clipper.blogspot.com

User avatar
Rathinagiri
Posts: 5324
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 200 times
Been thanked: 210 times
Contact:

Post by Rathinagiri »

It can be achieved by hooking "On Size" or "On Maximize" clause of Define window command.

We can easily write a small set of codes to manipulate this.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

CCH4CLIPPER
Posts: 130
Joined: Tue Mar 03, 2009 8:59 am
Been thanked: 1 time

Post by CCH4CLIPPER »

Hi Kathinagiri

Can you assist on this small set of codes ?



CCH
http://cch4clipper.blogspot.com

User avatar
sudip
Posts: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 2 times

Post by sudip »

Hi,

This might be like:

function sizetest
main.browse_1.width := main.width-50
main.browse_1.height := main.height-50
return nil

Regards.

Sudip
With best regards,
Sudip

User avatar
Rathinagiri
Posts: 5324
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 200 times
Been thanked: 210 times
Contact:

Post by Rathinagiri »

Thank you Sudip. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

CCH4CLIPPER
Posts: 130
Joined: Tue Mar 03, 2009 8:59 am
Been thanked: 1 time

Post by CCH4CLIPPER »

Hi Sudip/Kathinagiri

Why doesn't this work ?

* MyBrowse.prg
STATIC nWidth,nHeight, brwWidth, nbrwHeight
#include "minigui.ch"

Function BrowseGLAC

nWidth := GetDesktopWidth() * 0.75
nHeight := GetDesktopHeight() * 0.75

nbrwWidth := GetDesktopWidth() * 0.75 - 20
nbrwHeight := GetDesktopHeight() * 0.75 - 75

DEFINE WINDOW BrowseGLACForm ;
AT 0,0 ;
WIDTH nWidth HEIGHT nHeight ;
TITLE 'Browse Chart of Accounts' ;
CHILD ;
ON INIT (OpenTables()) ;
ON RELEASE CloseTables() ;
ON MAXIMIZE ResizeMaximize()

DEFINE STATUSBAR
DATE
STATUSITEM '<Enter> / Double Click To Edit' WIDTH 190
STATUSITEM 'Alt+A: Append Record' WIDTH 140
STATUSITEM '<Del>: Delete Record' WIDTH 140
CLOCK
END STATUSBAR

@ 10,10 BROWSE Browse_1 ;
WIDTH nbrwWidth ;
HEIGHT nbrwHeight ;
HEADERS { 'GL Code' , 'GL Name' , 'GL Type', 'GL Group'} ;
WIDTHS { 80 , 320 , 80 , 80 , 120 } ;
WORKAREA GLAC ;
FIELDS { 'GLAC->GLCODE' , 'GLAC->GLNAME' , 'GLAC->GLTYPE' , 'GLAC->GLGROUP'} ;
VALUE 1 ;
EDIT ;
APPEND;
DELETE;
LOCK
END WINDOW

CENTER WINDOW BrowseGLACForm
BrowseGLACForm.Browse_1.SetFocus
ACTIVATE WINDOW BrowseGLACForm
Return Nil

Function resizeMaximize
nbrwWidth := GetDesktopWidth() - 20
nbrwHeight := GetDesktopHeight() - 75

return

CCH: On launching, it displays perfectly but on Clicking Maxiimise, the browse rectangle does not expand to fit the maximized window.

Any pointer where I have gone wrong


CCH
http://cch4clipper.blogspot.com

User avatar
sudip
Posts: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 2 times

Post by sudip »

Hi CCH,

In my opinion please add "ON SIZE ..." and your problem will be solved.

DEFINE WINDOW BrowseGLACForm ;
AT 0,0 ;
WIDTH nWidth HEIGHT nHeight ;
TITLE 'Browse Chart of Accounts' ;
CHILD ;
ON INIT (OpenTables()) ;
ON RELEASE CloseTables() ;
ON MAXIMIZE ResizeIt() ;
ON SIZE ResizeIt()

...
...

FUNCTION ResizeIt()
...
...
RETURN NIL

Regards.

Sudip
With best regards,
Sudip

CCH4CLIPPER
Posts: 130
Joined: Tue Mar 03, 2009 8:59 am
Been thanked: 1 time

Post by CCH4CLIPPER »

HI Sudip/Kathinagiri

Solved. This issue is now closed.

TQVM


CCH
http://cch4clipper.blogspot.com

Post Reply