A problem with < oCtrl:cVarName > from TRadio and TDatepick

A problem with < oCtrl:cVarName > from TRadio and TDatepick

Postby ukoenig » Fri Mar 29, 2019 11:38 am

Hello,

I noticed a problem using < oCtrl:cVarName >
that returns the object-name.

The function shows all infos of a object on focus

Image

because of the error ( NIL ) I replaced the info with ???

On TRADIO and TDATEPICK ::cVarName exists but returns NIL
All other controls are working.

from :
METHOD cGenPRG( lDlgUnits ) CLASS TDatePick
...
...
cPrg += CRLF + " @ " + cTop + ", " + cLeft + ;
" DTPICKER " + ::cVarName + ' VAR ' + "d" + SubStr( ::cVarName, 2 ) + ' ' + ;
" ;" + CRLF + ' SIZE ' + cWidth + ", " + cHeight + ;
" PIXEL OF " + ::oWnd:cVarName + CRLF

and from :

METHOD cGenPRG( lDlgUnits ) CLASS TRadio
...
...
cPrg += CRLF + " @ " + cTop + ", " + cLeft + ;
" RADIOITEM " + ::cVarName + ' PROMPT "' + ::cCaption + '"' + ;
" ;" + CRLF + ' SIZE ' + cWidth + ", " + cHeight + ;
" PIXEL OF " + ::oWnd:cVarName + " ;" + CRLF + ;
' RADIOMENU ' + ::oRadMenu:cVarName + CRLF

Code: Select all  Expand view


SetKey( VK_F2, { || OBJ_INFO() } )

//--------- on FOCUS -------------------

STATIC FUNCTION OBJ_INFO()
LOCAL oCtrl := oWndFromHwnd( GetFocus() ), aCors[5]

aCors[1] := oCtrl:cVarName
IF aCors[1] = NIL
    aCors[1] := "???"
ENDIF
aCors[2] := ALLTRIM(STR(oCtrl:nTop))
aCors[3] := ALLTRIM(STR( oCtrl:nLeft ))  
aCors[4] := ALLTRIM(STR( oCtrl:nWidth ))
aCors[5] := ALLTRIM(STR(oCtrl:nHeight))
IF oCtrl:ClassName() = "TRADIO" // to be calculated !
     //aCors[1] := oCtrl:oRadMenu:cVarName
     aCors[2] := ALLTRIM(STR( oCtrl:nTop - ;
                      ( oCtrl:nHeight / 2 ) ) )
     aCors[5] := ALLTRIM(STR(oCtrl:nHeight * ;
                      LEN( oCtrl:oRadMenu:aItems ) ) )
ENDIF

MsgInfo( "Dialog title : " + oCtrl:oWnd:GetText() + CRLF + ;
"Dialog obj. : " + oCtrl:oWnd:cVarName + CRLF + ;
"Focused object : " + oCtrl:ClassName() + CRLF + ;
"Called from: "+ ProcName( 1 ) + CRLF + ;
"ProcLine : " + ALLTRIM(STR( ProcLine( 1 ) ) ) + CRLF + CRLF + ;
"Obj. name : " + aCors[1] + CRLF + ;
"Top :     " + aCors[2] + CRLF + ;
"Left :     " + aCors[3] + CRLF + ;
"Width : "  + aCors[4] + CRLF + ;
"Hight :  " + aCors[5] )

RETURN NIL
 


regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests