LOCAL oSelf := SELF
...
ACTIVATE WINDOW ::oWnd ;//MAXIMIZED;
ON INIT ...
ON RESIZE oSelf:SetSize( nSizeType, nWidth, nHeight ) ;
VALID oSelf:End()
...
METHOD SetSize( nType, nWidth, nHeight ) CLASS MpCal
local nCntrl := aScan( ::oWnd:aControls, { |e| upper( e:ClassName() ) $ "TTOOLBAR,TREBAR,TBAR,TRIBBONBAR" } )
LOCAL aClient := GetClientRect ( ::oWnd:hWnd ), i
if nWidth != nil
if nCntrl > 0 .and. nHeight != Nil ; nHeight -= ::oWnd:aControls[ nCntrl ]:nHeight ;endif
::oGridViewDlg:SetSize( aClient[4] - 1, nHeight, .T. )
::oGridViewDlg:Move( 0, 0 )
::oGridViewDlg:Show()
::oGridViewDlg:Refresh()
IF ::oGridView == NIL
RETURN NIL
ENDIF
::oGridView:SetSize( ::oGridViewDlg:nWidth, ::oGridViewDlg:nHeight , .T. )
::oGridView:Move( 0, 0 )
::oGridView:SetFocus()
RETURN NIL
//---------------------------------------------------//
//
METHOD SetSize( nType, nWidth, nHeight ) CLASS MpCal
local nCntrl := aScan( ::oWnd:aControls, { |e| upper( e:ClassName() ) $ "TTOOLBAR,TREBAR,TBAR,TRIBBONBAR" } )
LOCAL aClient := GetClientRect ( ::oWnd:hWnd ), i
if nWidth != nil
if nCntrl > 0 .and. nHeight != Nil ; nHeight -= ::oWnd:aControls[ nCntrl ]:nHeight ;endif
IF ::oRibbon:nOption == 1
::oPanelExplorer:Move( , , , nHeight )
::oPanelCalex:Move( , , nWidth - ::oPanelExplorer:nRight, nHeight )
RETURN NIL
ENDIF
::oWndChild:SetSize( aClient[ 4 ]-1, nHeight, .T. )
::oWndChild:Move( 0, 0 )
IF ::oRibbon:nOption == 2
::oGridViewDlg:SetSize( aClient[4] - 1, nHeight, .T. )
::oGridViewDlg:Move( 0, 0 )
::oGridViewDlg:Show()
::oGridViewDlg:Refresh()
IF ::oGridView == NIL ; RETURN NIL ; ENDIF
::oGridView:SetSize( ::oGridViewDlg:nWidth, ::oGridViewDlg:nHeight , .T. )
::oGridView:Move( 0, 0 )
::oGridView:SetFocus()
ENDIF
IF ::oRibbon:nOption == 3 ... ;ENDIF
ENDIF
RETURN NIL
Antonio Linares wrote:Use FWH layouts!
They work really great
joseluisysturiz wrote:Antonio, hay sample o pueden colocar el uso de la clase Layouts.? gracias, saludos...
D.Fernandez wrote:Hello, tLayout wotk from resources?
Thank you very much.
Saludos
Ruben Dario Fernandez
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 8.00".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
// LANGUAGE LANG_KOREAN,SUBLANG_KOREAN
D_BROWSE DIALOGEX FIXED IMPURE 97, 119, 347, 245
STYLE WS_POPUP|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
EXSTYLE 0x00000100
CAPTION "Dialog Resize"
FONT 9, "MS Sans Serif", 0, 0, 0
{
CONTROL "", 401, "SysTabControl32", 0x00000000, 200, 56, 140, 84
CONTROL "undefined static text", -1, "Static", WS_GROUP, 9, 12, 104, 8
CONTROL "undefined group", -1, "Button", BS_GROUPBOX|WS_DISABLED, 4, 36, 340, 180
CONTROL "", 101, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 140, 8, 200, 14
CONTROL "save", 201, "Button", WS_TABSTOP, 208, 220, 64, 20
CONTROL "cancel", 202, "Button", WS_TABSTOP, 276, 220, 64, 20
CONTROL "Custom control", 301, "TxBrowse", WS_DISABLED|0x00100000, 12, 56, 180, 84
CONTROL "Custom control", 302, "TxBrowse", WS_DISABLED|0x00100000, 12, 144, 328, 64
}
#include "fivewin.ch"
#include "xbrowse.ch"
/*
2012.07.08 Charles Kwon made to my suggestion.
ToDo : 1. Do not act in MDI yet.
2. When define each control, I wish to can give factor of 4 directions .or. obj:bFacter(||....)
*/
Static oInfo
FUNCTION Main()
LOCAL oDlg
LOCAL oBrw
LOCAL oBrw2
LOCAL oFld
LOCAL oBtn
LOCAL bSetup := { | oObj, cTitle, nAt, nID, cClsName, oSelf | SetupDlg( oObj, cTitle, nAt, nID, cClsName, oSelf ) }
SET RESOURCES TO "DlgResiz.dll"
USE customer NEW // FiveWin samples
DEFINE DIALOG oDlg RESOURCE "D_BROWSE"
oDlg:bStart := { | | oInfo := TDlgResize():New( oDlg, bSetup ) }
oDlg:bResized := { | nSizeType, nWidth, nHeight | oInfo:Resize( nWidth, nHeight ) }
REDEFINE XBROWSE oBrw ID 301 OF oDlg AUTOCOLS
REDEFINE XBROWSE oBrw2 ID 302 OF oDlg AUTOCOLS
REDEFINE FOLDER oFld ID 401 OF oDlg PROMPT "&One", "&Two", "&Three"
REDEFINE BUTTON oBtn ID 202 ACTION oDlg:End()
ACTIVATE DIALOG oDlg
Set Resources to
customer->( dbCloseArea() )
RETURN NIL
/*
Dlg Controls Setup
*/
FUNCTION SetupDlg( oObj, cTitle, nAt, nID, cClsName, oSelf )
LOCAL oFindObj
oObj:nTopStyle := 1 // 1.NONE 2.Upper relative position 3.Follow to Under Control OR Dialog Bottom
oObj:nLeftStyle := 1 // 1.NONE 2.Left relative position 3.Follow to Right Control OR Dialog Right
oObj:nRightStyle := 1 // 1.NONE 2.Dialog Width * Appointment Control
oObj:nBottomStyle := 1 // 1.NONE 2.Dialog Bottom * Appointment Control
DO CASE
CASE nAt == 2 // undefind static text. Resource Order 2
oObj:nTopStyle := 1
oObj:nLeftStyle := 1
oObj:nRightStyle := 1
oObj:nBottomStyle := 1
CASE nAt == 3 // undefined group . Resource Order 3
oObj:nTopStyle := 1
oObj:nLeftStyle := 1
oObj:nRightStyle := oSelf:FindByID( 401 )
oObj:nBottomStyle := oSelf:FindByID( 202 )
CASE nID == 101 // get . Resource Order 4
oObj:nTopStyle := 1
oObj:nLeftStyle := 3 // Follow to Dialog Right
oObj:nRightStyle := 1
oObj:nBottomStyle := 1
CASE nId == 201 // save . Resource Order 5
oObj:nTopStyle := 3
oObj:nLeftStyle := 3
oObj:nRightStyle := 1
oObj:nBottomStyle := 1
CASE nID == 202 // cancel . Resource Order 6
oObj:nTopStyle := 3
oObj:nLeftStyle := 3
oObj:nRightStyle := 1
oObj:nBottomStyle := 1
CASE nID == 401 // . Resource Order 1
oObj:nTopStyle := 1
oObj:nLeftStyle := 3
oObj:nRightStyle := 1
oObj:nBottomStyle := 1
CASE nID == 301 // . Resource Order 7
oObj:nTopStyle := 1
oObj:nLeftStyle := 1
oObj:nRightStyle := oSelf:FindByID( 401 ) // Appointment Control
oObj:nBottomStyle := oSelf:FindByID( 302 ) // or oSelf:aChilds[5]
CASE nID == 302 // . Resource Order 8
oObj:nTopStyle := 2
oObj:nLeftStyle := 1 // 3
oObj:nRightStyle := oSelf:FindByID( 401 ) // or oSelf:aChilds[6]
oObj:nBottomStyle := oSelf:FindByID( 202 ) // or oSelf:aChilds[6]
ENDCASE
RETURN NIL
//
//
CLASS TDlgResize
DATA oDlg
DATA aChilds AS ARRAY INIT {}
DATA nTop
DATA nLeft
DATA nBottom
DATA nRight
DATA nHeight
DATA nWidth
DATA bSetup
METHOD New( oDlg ) CONSTRUCTOR
METHOD GetChilds()
METHOD AddChild( hWnd )
METHOD Resize( nWidth, nHeight )
METHOD FindByID( nID )
ENDCLASS
METHOD New( oDlg, bSetup ) CLASS TDlgResize
LOCAL aRect := {}
LOCAL oChild
LOCAL nI
::oDlg := oDlg
//aRect := GetCoors( oDlg:hWnd )
aRect := GetWndRect( oDlg:hWnd )
::nTop := aRect[ 1 ]
::nLeft := aRect[ 2 ]
::nBottom := aRect[ 3 ]
::nRight := aRect[ 4 ]
::nHeight := aRect[ 3 ] - aRect[ 1 ] + 1
::nWidth := aRect[ 4 ] - aRect[ 2 ] + 1
::bSetup := bSetup
::GetChilds()
IF ::bSetup <> NIL
FOR nI := 1 TO LEN( ::aChilds )
oChild := ::aChilds[ nI ]
EVAL ( ::bSetup, oChild, GetWindowText( oChild:hWnd ), nI, oChild:nID , oChild:cClsName, Self )
NEXT
ENDIF
RETURN Self
//
METHOD GetChilds() CLASS TDlgResize
::aChilds := {}
EnumChildWindows( ::oDlg:hWnd , { | hWnd | ::AddChild( hWnd ) } )
return NIL
//
METHOD AddChild( hWnd ) CLASS TDlgResize
LOCAL oChild
oChild := TDlgResizeItem():New( hWnd, Self )
AADD ( ::aChilds, oChild )
return nil
//
METHOD Resize( nWidth, nHeight ) CLASS TDlgResize
local ni
AEVAL ( ::aChilds, {|o|o:lResized := .f. } )
AEVAL ( ::aChilds, {|o|o:Resize( nWidth, nHeight ) } )
::oDlg:Refresh(.f.)
RETURN NIL
//
METHOD FindByID( nID ) CLASS TDlgResize
LOCAL nI
FOR nI := 1 TO LEN( ::aChilds )
IF ::aChilds[nI]:nID == nID
RETURN ::aChilds[nI]
ENDIF
NEXT
MsgInfo( "ID "+ALLTRIM(STR(nId))+" not found. So return 1")
RETURN 1
#pragma BEGINDUMP
#include <Windows.h>
#include <hbapi.h>
#include <hbapiitm.h>
static PHB_ITEM pCodeBlock = NULL, pParam = NULL;
static BOOL CALLBACK EnumChildProc( HWND hWnd, LPARAM lParam )
{
PHB_ITEM pNumber = hb_itemPutNL( NULL, ( LONG ) hWnd );
if( lParam )
hb_evalBlock( pCodeBlock, pNumber, lParam, NULL );
else
hb_evalBlock1( pCodeBlock, pNumber );
hb_itemRelease( pNumber );
return TRUE;
}
HB_FUNC( ENUMCHILDWINDOWS )
{
pCodeBlock = hb_param( 2, HB_IT_BLOCK );
pParam = hb_param( 3, HB_IT_NUMERIC );
hb_retl( EnumChildWindows( ( HWND ) hb_parnl( 1 ), EnumChildProc, hb_parnl( 2 ) ) );
pCodeBlock = NULL;
pParam = NULL;
}
HB_FUNC( GETDLGCTRLID )
{
hb_retni( GetDlgCtrlID( ( HWND ) hb_parnl( 1 ) ) );
}
#pragma ENDDUMP
//
CLASS TDlgResizeItem
DATA oParent
DATA oDlg
DATA hWnd
DATA nTop
DATA nLeft
DATA nBottom
DATA nRight
DATA nHeight
DATA nWidth
DATA nTopStyle
DATA nLeftStyle
DATA nRightStyle
DATA nBottomStyle
DATA aRect2
DATA lResized AS LOGICAL INIT .F.
DATA nID
DATA cClsName
METHOD New() CONSTRUCTOR
METHOD Resize ( nWidth, nHeight )
ENDCLASS
//
METHOD New( hWnd, oParent ) CLASS TDlgResizeItem
LOCAL aRect := {}
LOCAL aRect2 := {}
::oParent := oParent
::oDlg := oParent:oDlg
::hWnd := hWnd
aRect := GetCoors( ::hWnd ) // Absolute coordinate
::aRect2 := GetWndRect( ::hWnd )
::nId := GetDlgCtrlID( ::hWnd )
::cClsName := GetClassName( ::hWnd )
::nTop := aRect[ 1 ]
::nLeft := aRect[ 2 ]
::nBottom := aRect[ 3 ]
::nRight := aRect[ 4 ]
::nHeight := aRect[ 3 ] - aRect[ 1 ] + 1
::nWidth := aRect[ 4 ] - aRect[ 2 ] + 1
RETURN Self
//
METHOD Resize ( nWidth, nHeight ) CLASS TDlgResizeItem
LOCAL nTop
LOCAL nLeft
LOCAL nHeight2
LOCAL nWidth2
LOCAL oObj
LOCAL aRect
LOCAL lNoChangeHeight := .f.
LOCAL lNoChangeWidth := .f.
IF ::lResized
RETURN NIL
ENDIF
::lResized := .T.
IF nHeight >= ::oParent:nHeight
nTop := int ( ( nHeight * ::nTop / ::oParent:nHeight ) ) // top
nHeight2 := int ( ( nHeight * ::nHeight / ::oParent:nHeight ) ) // height
ELSE
nTop := ::nTop
nHeight2 := ::nHeight
lNoChangeHeight := .t.
ENDIF
IF nWidth >= ::oParent:nWidth
nLeft := int ( ( nWidth * ::nLeft / ::oParent:nWidth ) )
nWidth2 := int ( ( nWidth * ::nWidth / ::oParent:nWidth ) )
ELSE
nLeft := ::nLeft
nWidth2 := ::nWidth
lNoChangeWidth := .t.
ENDIF
/*
IF lNoChangeHeight .or. lNoChangeWidth
MoveWindow( ::hWnd, ::nTop, ::nLeft, ::nWidth, ::nHeight, .t. )
RETURN NIL
ENDIF
*/
DO CASE
CASE ::nTopStyle == 1
nTop := ::nTop
CASE ::nTopStyle == 3
nTop := nHeight - ::nHeight - ( ::oParent:nBottom - ::aRect2[3] ) + 1
ENDCASE
DO CASE
CASE ::nLeftStyle == 1
nLeft := ::nLeft
CASE ::nLeftStyle == 3
nLeft := nWidth - ::nWidth - ( ::oParent:nRight - ::aRect2[4] ) + 1
ENDCASE
IF VALTYPE ( ::nRightStyle ) == "N"
DO CASE
CASE ::nRightStyle == 1
nWidth2 := ::nWidth
ENDCASE
ELSE
oObj := ::nRightStyle
oObj:Resize( nWidth, nHeight )
aRect := GetCoors( oObj:hWnd )
nWidth2 := aRect[2] - nLeft - ( oObj:aRect2[2] - ::aRect2[4] )
ENDIF
IF VALTYPE( ::nBottomStyle ) == "N"
DO CASE
CASE ::nBottomStyle == 1
nHeight2 := ::nHeight
ENDCASE
ELSE
oObj := ::nBottomStyle
oObj:Resize( nWidth, nHeight )
aRect := GetCoors( oObj:hWnd )
nHeight2 := aRect[1] - nTop - ( oObj:aRect2[1] - ::aRect2[3] )
ENDIF
MoveWindow( ::hWnd, nTop, nLeft, nWidth2, nHeight2, .t. )
RETURN NIL
Daniel Garcia-Gil wrote:D.Fernandez wrote:Hello, tLayout wotk from resources?
Thank you very much.
Saludos
Ruben Dario Fernandez
Hello, not work with resources
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 43 guests