Resizing a Window

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Resizing a Window

Post by Silvio.Falconi »

I wish remake a window I saw on a application (Espress Invoice)

It use a easy window with some controls can be resize no problems and all control are resized!!!!!

When the window is on initial coordinates

Image

When the user resize the window ( it run ok id the window is maximized)

Image



I tried to remake the same with our fwh and xharbour but I not Know How we can make it

to try I build a small test sample : 3 folder, 1 xbrowse , 3 buttons

and I tried to resize the window with the function RESIZECONTROLS(nSizeType,nWidth,nHeight,oWnd )

when I resize the window all controls are resized but it is not good !!!


Have You some prupose ?

this is the test sample :

Code: Select all

#include 'fivewin.ch'
#include 'xbrowse.ch'


FUNCTION MAIN() 

 LOCAL oWnd
 Local oBtn[10]
Local oFld1
Local oFld2
Local oFld3
Local oBrw




 USE CUSTOMER ALIAS CUST


    DEFINE WINDOW oWnd  from 1,1 to 35,104


      @ 3, 4  FOLDER oFld1 PIXEL   ;
         ITEMS "&Billing","Shipping";
         SIZE 400,100

      @ 3, 500  FOLDER oFld2 PIXEL   ;
         ITEMS "&Invoice";
         SIZE 250,100



      @ 201,20 XBROWSE oBrw OF oWnd SIZE 750,200 PIXEL ;
      COLUMNS "First", "State", "Age", "HireDate", "Salary" ;
      ALIAS 'CUST' NOBORDER

      oBrw:lRecordSelector := .f.
      oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7
      oBrw:CreateFromCode()



                        @ oBrw:nbottom+10, 2 BUTTON oBtn PROMPT "&Nuovo articolo" ;
                         SIZE 55, 20 PIXEL OF oWnd ACTION nil
                        @ oBrw:nbottom+10, 62 BUTTON oBtn PROMPT "&Modifica articolo" ;
                         SIZE 55, 20 PIXEL OF oWnd ACTION nil
                        @ oBrw:nbottom+10, 120 BUTTON oBtn PROMPT "&Cancella articolo" ;
                         SIZE 55, 20 PIXEL OF oWnd ACTION nil



        @ oBrw:nbottom+60, 4  FOLDER oFld3 PIXEL   ;
         ITEMS "&Comments","Private comments";
         SIZE 200,50






    ACTIVATE WINDOW oWnd;
             ON RESIZE RESIZECONTROLS(nSizeType,nWidth,nHeight,oWnd );

    RETURN NIL








STATIC FUNCTION RESIZECONTROLS(nSizeType,nWidth,nHeight, oWnd )
LOCAL oCtl

LOCAL i

STATIC aWidth  := {}
STATIC aHeight := {}

STATIC StartWidth , StartHeight

IF EMPTY( aWidth )
   FOR EACH oCtl IN oWnd:aControls
      AADD( aWidth , oCtl:nWidth() )
      AADD( aHeight , oCtl:nHeight() )
   NEXT
   StartWidth  := oWnd:nWidth()
   StartHeight := oWnd:nHeight()
ENDIF
FOR EACH oCtl IN oWnd:aControls
  i := Hb_EnumIndex()
  oCtl:Move( oCtl:nTop, oCtl:nLeft, aWidth[i]* oWnd:nWidth()/StartWidth , aHeight[i] * oWnd:nHeight()/StartHeight , .T. )
NEXT

RETURN NIL
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: Resizing a Window

Post by Patrizio »

Silvio, try this

Code: Select all

oCtl:Move( oCtl:nTop, oCtl:nLeft, aWidth[i] + oWnd:nWidth() - StartWidth , aHeight[i] + oWnd:nHeight() - StartHeight , .T. )
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Resizing a Window

Post by Silvio.Falconi »

No Patrizio not run good ( can you send me a message to private email I want ask a question )


To see what I mean you try modest.prg on Minigui samples/applications you can see a window with controls resize good!!!

Any solution for fivewin for xharbour ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Resizing a Window

Post by Silvio.Falconi »

Perhaps I resolved ....


I would like to size the window to the initial coordinates.
if the user tries to tighten the window, the window must remain with the initial coordinates
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply