Page 1 of 1

Tsbrowse and lostfocus

Posted: Fri Oct 07, 2005 11:34 am
by Guest
Hi,
I succesfully work with TSBrowse 7.0,
my only problem is when I write a new value in a cell
because that value will not be assigned if the user change the focus to
another control (for example press an "Exit" button after wrote the new
value
in the cell).
The new value is assigned only if I go to another cell after inserted the
new value.

Is there any way to assign the new value to the cell when the browse lost
the focus ?

See this sample code:
#include "FiveWin.ch"
#include "TSBrowse.ch"

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

static oDlg

function Main()

local aArray,oBrw

aArray:=array(0,2)
aadd(aArray,{"Marko",4})
aadd(aArray,{"Robert",5})
aadd(aArray,{"Mary",6})

DEFINE DIALOG oDlg FROM 2,2 TO 24, 75 TITLE "Test "

@ 1.5, 1 TSBROWSE oBrw CELLED OF oDlg ;

oBrw:SetArray(aArray)

TSADD COLUMN TO oBrw DATA ARRAY ELEMENT 1;
HEADER "Name";
3DLOOK FALSE, TRUE, TRUE ;
ALIGN DT_RIGHT, DT_LEFT, DT_RIGHT;
EDITABLE MOVE DT_MOVE_RIGHT;
SIZE 100

TSADD COLUMN TO oBrw DATA ARRAY ELEMENT 2;
HEADER "Age";
3DLOOK FALSE, TRUE, TRUE ;
ALIGN DT_RIGHT, DT_LEFT, DT_RIGHT;
EDITABLE MOVE DT_MOVE_RIGHT;
PICTURE "@k 999";
SIZE 100


@ 0.2, 1 BUTTON "E&xit" OF oDlg SIZE 30,12;
ACTION (MsgInfo("Marko's age is "+str(aArray[1,2])),oDlg:End())

@0.2,10 SAY "Write 15 into the Marko's age cell and then press Exit, as
you can see the new value is not token."+CHR(13)+CHR(10)+"I want that the
new value will be assigned with the lostfocus too !" OF ODLG

ACTIVATE DIALOG oDlg
return nil



Thanks in advance

Best Regards,

--
Marco Turco
SOFTWARE XP LLP, London
www.softwarexp.co.uk

Tsbrowse and lostfocus

Posted: Sat Oct 08, 2005 9:22 am
by Detlef Hoefner
Hi Marco,

have a look at the sbtest.prg sample.
There you can see the usage of bPostEdit.

Maybe this could solve your problem.

Regards,
Detlef

Posted: Tue Oct 11, 2005 4:32 pm
by Marco Turco
Hi Detlef,
I tried but this method is not called when the browse lost the focus.
However I solved with a small modify into the EditExit method.

Best Regards,

Marco