
Antonio,
When calling SetCoors() on a TPanel (or any class derived from TControl),
FWH raises:
Error BASE/1004 No exported method: nTop
because TPanel does not export the variables nTop, nLeft, nBottom, nRight
โ they exist only in TWindow and its descendants.
So SetCoors() works for TWindow, TDialog, TMDIChild, etc.,
but not for TPanel (or derived classes such as our custom canvas).
Please try this sample
#include "FiveWin.ch"
FUNCTION Main()
LOCAL oWnd, oPan, oBr
DEFINE BRUSH oBr COLOR CLR_RED
DEFINE WINDOW oWnd TITLE "SetCoors() vs TPanel test"
// Create a plain TPanel used as a custom canvas
// NOTE: TPanel():New usually expects (top, left, bottom, right, owner) in older FWH;
// we pass small initial coords and resize it right after.
oPan := TPanel():New( 0, 0, 100, 100, oWnd )
// Make sure the panel paints white so we can see it clearly
*
oPan:SetBrush( oBr )
// Resize handler
oWnd:bResized := { || FitPanel( oWnd, oPan ) }
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION FitPanel( oWnd, oPan )
LOCAL aCli, nTop, nLeft, nBottom, nRight
aCli := GetClientRect( oWnd:hWnd ) // { top, left, bottom, right }
nTop := 0
nLeft := 0
nBottom := aCli[3]
nRight := aCli[4]
// ---- This call raises a runtime error with TPanel ----
// Error BASE/1004 No exported method: nTop
// oPan:SetCoors( nTop, nLeft, nBottom, nRight )
// ---- This call works fine with TPanel (width/height) ----
oPan:Move( nTop, nLeft, nRight - nLeft, nBottom - nTop )
InvalidateRect( oPan:hWnd, 0, .T. )
UpdateWindow( oPan:hWnd )
RETURN NIL// Error BASE/1004 No exported method: nTop
oPan:SetCoors( nTop, nLeft, nBottom, nRight ) this not run
// ---- This call works fine with TPanel (width/height) ----
oPan:Move( nTop, nLeft, nRight - nLeft, nBottom - nTop ) This run
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com