Page 1 of 1

::Refresh() needed in TMultiGet's ::GotFocus(),::LostFocus()

Posted: Mon Jul 31, 2006 3:13 am
by RAMESHBABU
Mr.Antonio

The GotFocus() functionality for TMultiGet class was not working properly
until I have added a ::Refresh() clause in GotFocus() and LostFocus()
methods in TMGet.prg. After adding ::Refresh() clasuse only the
expected functionality is achived.

I am using FWH 2.7 July Build & xHarbour 0.99.61.

This is for your information

- Ramesh Babu P

// Testing a GET

#include "FiveWin.ch"

//------------------------------------------------------------------------//

function Main()

local oDlg
local dDay := Date(), cNotes
local oGet, oGet1

SET DATE BRIT
SET CENT ON

DEFINE DIALOG oDlg TITLE "Testing GotFocus() Clause of TMultiGet Class"

@ 0.50, 2 SAY "Date:" OF oDlg
@ 0.50, 6 GET oGet VAR dDay OF oDlg SIZE 23, 10 SPINNER ;
VALID ! Empty( dDay ) ;
COLORS nRGB( 0, 0, 0 ), nRGB( 224, 224, 249 )

@ 2.00, 2 SAY "Notes:" OF oDlg
@ 2.00, 6 GET oGet1 VAR cNotes OF oDlg SIZE 100, 25 MEMO;
COLORS nRGB( 0, 0, 0 ), nRGB( 224, 224, 249 )

@ 3.25, 7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
@ 3.25,16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

oGet:bGotFocus := { || oGet:SetColor(nRGB(255,255,255), nRGB(64,0,255)) }
oGet1:bGotFocus := { || oGet1:SetColor(nRGB(255,255,255), nRGB(64,0,255)), oGet1:Refresh() } // For demonstration I have added oGet1:Refresh() here
oGet1:bLostFocus := { || oGet1:SetColor(nRGB(0,0,0), nRGB(224,224,249)), oGet1:Refresh() } // For demonstration I have added oGet1:Refresh() here

ACTIVATE DIALOG oDlg CENTERED

RETURN nil

//------------------------------------------------------------------------//

procedure AppSys // Xbase++ requirement

return

//------------------------------------------------------------------------//

#ifdef __XPP__
#define GetNew _GetNew
#endif

#ifndef __CLIPPER__

CLASS TClipGet FROM Get

METHOD Display() VIRTUAL

ENDCLASS

//---------------------------------------------------------------------------//

function GetNew( nRow, nCol, bVarBlock, cVarName, cPicture, cColor )

return TClipGet():New( nRow, nCol, bVarBlock, cVarName, cPicture, cColor )

//---------------------------------------------------------------------------//

#endif

Posted: Mon Jul 31, 2006 6:49 am
by Antonio Linares
Ramesh,

Yes, it is needed as you are changing the colors so you need to request a repaint of the control.