FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ON RESIZE "automatic" -> Layout Manager ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
ON RESIZE "automatic" -> Layout Manager ?
Posted: Fri Dec 20, 2019 08:47 AM
hi,

does somebody have made a "Layout-Manager" for FiveWin RESIZE :-)

for each windows i have to write a function ... so i wrote a "Layout-Manager" for Xbase++
while Concept are for OOP i'm not sure if i can use that Technique with DIALOG Syntax.

after all Child on DIALOG are create i want to get Information of them as "Original" Value.

Code (fw): Select all Collapse
ON INIT Layoutmanager(self)

it will init a List (Array) of Child and it's Pos / Size.
this must work recursive if a Child is Parent for other Control

Code (fw): Select all Collapse
   aChildGen1 := oParent:Childlist()

   FOR i := 1 TO LEN(aChildGen1)
      oObject := aChildGen1[i]
      aChildGen2 := oObject:Childlist()
      IF LEN(aChildGen2) > 0
         Recursive(oObject)
      ELSE    
         aadd(::aLayout, {oParent,oParent:nHeight,oParent:nWidth,;
                          oObject,oObject:nTop,oObject:nLeft,oObject:nHeight,oObject:nWidth } )
      ENDIF
   NEXT

under Xbase++ i can ASCAN() for a Object :-)
i also can use o:Hwnd as workaround

Code (fw): Select all Collapse
ON RESIZE Layoutmanager:Resize(self)

here "automatic" begin
Code (fw): Select all Collapse
INLINE METHOD RESIZE(oIn)
   nDlgObj := oIn
or
   nDlgWnd ;= oIn:Hwnd

what i need is actual Size of DIALOG. this i need to calculate "Zoom-Faktor" to Original Size

now i start ASCAN() to get all Control to a Parent DIALOG
Code (fw): Select all Collapse
LOCAL nPosi := 1
LOCAL nStart := 1
LOCAL nHeight := oIn:nHeight
LOCAL nWidth := oIn:nWidth
   
   DO WHILE nPosi > 0   
      nPosi := ASCAN(::aLayout, {|e| e[1] = nDlgObj }, nStart )
      IF nPosi > 0
         ::ZoomY := ::aLayout[nPosi][2] / nHeight * 100
         ::ZoomX := ::aLayout[nPosi][3] / nWidth * 100
         oObject := ::aLayout[nPosi][4]
         oObject:SetPos( {::aLayout[nPosi][5]+::ZoomX,::aLayout[nPosi][6]*::ZoomY} )
         oObject:SetSize( {::aLayout[nPosi][7]+::ZoomX,::aLayout[nPosi][8]*::ZoomY} )
         nStart := nPosi +1
      ENDIF
   ENDDO    
   nDlgObj:InvalidRect()

under Xbase++ it work with all "Original Windows" Control.
it fail e.g. with XbpBrowse() which "self made" with WC_STATIC (many Child ...)

---

i'm still a FiveWin Newbie so some parts of puzzle are missing like

Childlist() -> get all Child of a DIALOG or WINDOW

to test my Idea :-)
or is hole Work obsolet while FiveWin have it but i have not found it yet :-)
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Mon Dec 30, 2019 06:44 PM

hi,

i found "Adjust" in many Sample. is this for automatic "resize" :?:

greeting,

Jimmy
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Fri Jan 03, 2020 09:46 PM

Hello Jimmy,

Would that mean that your DIALOGS and WINDOWS would then be responsive, too?
I mean that the screen is to small one line breaks into two, etc.
Do you think we could adopt a kind of CSS?

Best regards
Otto

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Sat Jan 04, 2020 02:05 AM
Otto wrote:
Would that mean that your DIALOGS and WINDOWS would then be responsive, too?

i'm not sure about "Adjust" any more while i can't "see" it run ...

i try to run Sample c:\fwh\samples\testsay.prg but i got Error about "@" :-)

Compiling 'testsay.prg' and generating preprocessed output to 'testsay.ppo'...
1 error

No code generated.
testsay.prg(30) Error E0030 Syntax error "syntax error at '@'"
* Compile errors *

it is still a Problem with FiveWin when those c:\fwh\samples\ does not work :-)
are those files in c:\fwh\samples\ "verified" or not :-)
greeting,

Jimmy
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Sat Jan 04, 2020 08:52 AM
Hello Jimmy,
I see ::lAdjust only in the SetText method of the TSay Class.
Best regards
Otto
C:\fwh\source\classes\say.prg
Code (fw): Select all Collapse
METHOD SetText( cText ) CLASS TSay

   local hDC, nWidth

   DEFAULT ::lTransparent := .f.

   ::cCaption := If( ::cPicture != nil, Transform( cText, ::cPicture ),;
                     cValToChar( cText ) )

   #ifndef __CLIPPER__
      if ! Empty( ::hWnd ) .and. ::oWnd:oBrush != nil .and. Empty( ::oWnd:oBrush:hBitmap ) .and. ( IsAppThemed() .or. ::lTransparent )
         DrawPBack( ::hWnd, hDC := GetDC( ::hWnd ) )
         ReleaseDC( ::hWnd, hDC )
      endif
   #endif

   if ! Empty( ::hWnd )
      if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_LEFT, SS_RIGHT, SS_CENTER ) ) .AND. ::lAdjust
         nWidth = GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) + 20
         if nWidth > ::nWidth
            ::nWidth = nWidth
         endif
      endif
      SetWindowText( ::hWnd, ::cCaption )
   endif

return nil
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Sat Jan 04, 2020 02:14 PM
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: ON RESIZE "automatic" -> Layout Manager ?
Posted: Sat Jan 04, 2020 09:05 PM
hi,

MGA wrote:http://forums.fivetechsupport.com/viewtopic.php?f=6&t=19298&p=164219&hilit=display3#p164219


thx for Tip.
i have Problem with download Display3.RAR while it need a Account to Twitter/Facebook or Google which i don't use

i got Source now from http://fivewin.com.br/index.php?/topic/21156-resolucao-da-tela/&/topic/21156-resolucao-da-tela/?hl=display#entry262057

but have Problem with HB_FUNC (VMUDAVIDEO)
Error E2227 adjust.prg 773: Extra parameter in call to hb_storni in function HB_FUN_VMUDAVIDEO
Error E2227 adjust.prg 774: Extra parameter in call to hb_storni in function HB_FUN_VMUDAVIDEO


---

as i understood Code you have to choose Resolution for Layout.
what i mean is e.g. "maximize" from "normal" 1280x800 to 1920x1024

what do i need : "Childlist"
i need to know Pos/Size of all Control place into a Dialog/Window

Code (fw): Select all Collapse
   ON INIT GetLayOut(This.Window)
  ON RESIZE DoLayout(This.Window)


just Dummy Code

Code (fw): Select all Collapse
PUBLIC aLayOut := {}

FUNCTION GetLayout(cIn)
LOCAL aChild := cIn:ChildList()
LOCAL i,iMax := LEN(aChild)
LOCAL oChild, aMore

   FOR i := 1 TO imax
      oChild := aChild[i]
      aMore := oChild:ChildList()
      IF LEN(aMore) > 0
         GetLayout(aChild)
      ELSE
         AADD(aLayout,{oChild, oChild:Pos, oChild:Size}) 
      ENDIF
   NEXT
RETURN .T.

Code (fw): Select all Collapse
FUNCTION DoLayout(cIn)            
LOCAL aChild := cIn:ChildList()
LOCAL i,iMax := LEN(aChild)
LOCAL oChild, aMore
LOCAL xZoom := 0, yZoom := 0

   CalcZoom(cIn,@xZoom, @yZoom) // cIN:NewSize <-> Original Size

   FOR i := 1 TO imax
      oChild := aChild[i]
      nPosi := ASCAN(aLayout,{|e| e[1] = oChild} )
      oChild:SetPos(aLayout[nPosi][2][1]*xZoom,aLayout[nPosi][2][2]*yZoom)
      oChild:SetSize(aLayout[nPosi][3][1]*xZoom,aLayout[nPosi][3][2]*yZoom)
      // also Calc on Font Size    
   NEXT
RETURN .T.


that Dummy Code is just a small Part which i have under Xbase++
it work well with OOP Code but have to find out how to "translate" it to FiveWin Syntax.

so my Question are how to translate

Code (fw): Select all Collapse
   aChild := cIn:ChildList()

how to get "Child" of Dialog / Window :-)

Code (fw): Select all Collapse
   nPosi := ASCAN(aLayout,{|e| e[1] = oChild} )

can i ASCAN for a Object under FiveWin :-)
greeting,

Jimmy

Continue the discussion