FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bGotFocus and bLostFocus on Radios ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
bGotFocus and bLostFocus on Radios ?
Posted: Mon May 16, 2011 09:25 PM
Hello,

oRadio:bGotFocus := {|hDC| ...... }
oRadio:bLostFocus := {|hDC| ....... }

doesn't work : Message not found Tradmenu.

Error description: Warning BASE/1005 Message not found: TRADMENU:_BGOTFOCUS
Stack Calls
===========
Called from: source\rtl\tobject.prg => TRADMENU:ERROR(172)
Called from: source\rtl\tobject.prg => TRADMENU:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TRADMENU:_BGOTFOCUS(0)


How to get Infos about Radio-focus/lostfocus ?

Best 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.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: bGotFocus and bLostFocus on Radios ?
Posted: Tue May 17, 2011 10:17 AM
Try

Code (fw): Select all Collapse
oRadio:aItems[ 1 ]:bGotFocus


EMG
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: bGotFocus and bLostFocus on Radios ?
Posted: Tue May 17, 2011 12:24 PM
Enrico,

Thank You very much, Borders on Radios are working now : Focus and Lostfocus ( a little bit complicated ).
I created a new Function ( different to the one used for other Controls ),
because it seems, nothing can be calculated.
I have to define Top, Left, Width and Height for the Function
or is it possible, to get the Coordinates of the used Area ?



Best 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.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: bGotFocus and bLostFocus on Radios ?
Posted: Tue May 17, 2011 01:28 PM

Are you able to get the coordinates of a single radio item?

EMG

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: bGotFocus and bLostFocus on Radios ?
Posted: Tue May 17, 2011 06:21 PM
Enrico,

Thank You very much.
I got it working now.

I created a extra Function for Radios :



@ 112, 20 RADIO oRadio VAR nValue OF oDlg PIXEL UPDATE ;
PROMPT "Item 1", "Radio-Item 2"
AEval( oRadio:aItems, { | aItems | aItems:bGotFocus := {|hDC| ;
Radio_Box( oDlg, oRadio, 2, nColorF, nSpace, nPen, nStyle, nShPos ) } } )

and on Top of the normal Control-function ( oRadio = STATIC )
to show oRadio LOSTFOCUS :

STATIC PROCEDURE Draw_Box(oDlg, oGet, nColor, nDistance, nPen, nMultiH, nStyle, nShadow)

AEval( oRadio:aItems, { | aItems | aItems:bLostFocus := {|hDC| ;
Radio_Box( oDlg, oRadio, 2, nColorL, nSpace, nPen, nStyle, nShPos ) } } )

The new Radio-box-function :

Code (fw): Select all Collapse
STATIC PROCEDURE Radio_Box(oDlg, oRadio, nItems, nColor, nDistance, nPen, nStyle, nShadow)
LOCAL I

//  x, y , nHigh, nWidth

nTop := oRadio:aItems[ 1 ]:nTop
nLeft := oRadio:aItems[ 1 ]:nLeft
nHeight := oRadio:aItems[ 1 ]:nHeight
nWidth := oRadio:aItems[ 1 ]:nWidth

// Search for longest Text
nTestW := 1 
FOR I := 1 TO nItems 
    nWidth := oRadio:aItems[ I ]:nWidth
    IF nWidth > nTestW
        nTestW := nWidth
    ENDIF
NEXT
nWidth := nTestW

IF nStyle = 1 // Border
   // Top
   DrawLine( oDlg, nTop - nDistance, nLeft - nDistance, ;
           nTop - nDistance, nLeft + nWidth + nDistance, ;
           nPen, nColor )
   // Bottom
   DrawLine( oDlg, nTop + nHeight * nItems + nDistance, nLeft - nDistance , ;
           nTop + nHeight * nItems + nDistance, nLeft + nWidth + nDistance, ;
           nPen, nColor )
   // Left
   DrawLine( oDlg, nTop - nDistance, nLeft - nDistance , ;
           nTop + nHeight * nItems + nDistance, nLeft - nDistance, ;
           nPen, nColor )
   // Right
   DrawLine( oDlg, nTop - nDistance, nLeft + nWidth + nDistance, ;
           nTop + nHeight * nItems + nDistance, nLeft + nWidth + nDistance, ;
           nPen, nColor )
ENDIF
IF nStyle = 2 // Shadow
   // Bottom
   DrawLine( oDlg, nTop + nHeight * nItems + nDistance, nLeft + nShadow , ;
           nTop + nHeight * nItems + nDistance, nLeft + nWidth + nDistance, ;
           nPen, nColor )
   // Right
   DrawLine( oDlg, nTop + nShadow , nLeft + nWidth + nDistance, ;
           nTop + nHeight * nItems + nDistance, nLeft + nWidth + nDistance, ;
           nPen, nColor )
ENDIF
IF nStyle = 3 // Underline
   // Bottom
   DrawLine( oDlg, nTop + nHeight * nItems + nDistance, nLeft, ;
          nTop + nHeight * nItems + nDistance, nLeft + nWidth, ;
          nPen, nColor )
ENDIF

RETURN


Best 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.

Continue the discussion