ON RESIZE "automatic" -> Layout Manager ?

ON RESIZE "automatic" -> Layout Manager ?

Postby Jimmy » Fri Dec 20, 2019 8: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: Select all  Expand view
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: Select all  Expand view
  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: Select all  Expand view
ON RESIZE Layoutmanager:Resize(self)

here "automatic" begin
Code: Select all  Expand view
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: Select all  Expand view
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 :idea:
or is hole Work obsolet while FiveWin have it but i have not found it yet :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby Jimmy » Mon Dec 30, 2019 6:44 pm

hi,

i found "Adjust" in many Sample. is this for automatic "resize" :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby Otto » Fri Jan 03, 2020 9: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby Jimmy » Sat Jan 04, 2020 2: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 "@" :shock:
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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby Otto » Sat Jan 04, 2020 8: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: Select all  Expand view

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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby MGA » Sat Jan 04, 2020 2:14 pm

ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: ON RESIZE "automatic" -> Layout Manager ?

Postby Jimmy » Sat Jan 04, 2020 9: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: Select all  Expand view
  ON INIT GetLayOut(This.Window)
  ON RESIZE DoLayout(This.Window)


just Dummy Code

Code: Select all  Expand view
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: Select all  Expand view
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: Select all  Expand view
  aChild := cIn:ChildList()

how to get "Child" of Dialog / Window :?:

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

can i ASCAN for a Object under FiveWin :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests

cron