Page 1 of 1

Resizing of Browse

Posted: Thu Mar 12, 2009 2:55 am
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

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 4:01 am
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.

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 7:54 am
by CCH4CLIPPER
Hi Kathinagiri

Can you assist on this small set of codes ?



CCH
http://cch4clipper.blogspot.com

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 8:11 am
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

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 8:39 am
by Rathinagiri
Thank you Sudip. :)

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 1:47 pm
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

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 1:55 pm
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

Re: Resizing of Browse

Posted: Thu Mar 12, 2009 2:11 pm
by CCH4CLIPPER
HI Sudip/Kathinagiri

Solved. This issue is now closed.

TQVM


CCH
http://cch4clipper.blogspot.com