When I click on 'Message 2" below, how to make oGet to show the new message.
- Code: Select all Expand view
- #include "FiveWin.ch"
function main()
local oDlg, oRad, nValue := 1
local oGet1
local lSave := .f.
local ctestget
if !file("test1.dbf")
createfilea()
endif
if (Select("test1") == 0)
use test1 new
index on msg1 to temp
else
select Select("test1")
endif
Append Blank
onerror("APPEND")
Replace msg1 With "This is message 1"
Replace msg2 With "This is message 2"
Replace msg3 With "This is message 3"
if nValue = 1
ctestget = msg1
elseif nValue = 2
ctestget = msg2
else
ctestget = msg3
endif
DEFINE DIALOG oDlg FROM 0, 0 TO 26, 79 ;
TITLE "Test"
@ 0.2, 2 RADIO oRad VAR nValue ITEMS "Message 1" OF oDlg SIZE 40, 10 ;
ON CHANGE { || radiobtntest(1, oGet1) } UPDATE
@ 0.2, 17 RADIOITEM "Message 2" RADIOMENU oRad OF oDlg SIZE 40, 10;
ON CHANGE { || radiobtntest(2, oGet1) } UPDATE
@ 0.2, 32 RADIOITEM "Message 3" RADIOMENU oRad OF oDlg SIZE 40, 10;
ON CHANGE { || radiobtntest(3, oGet1) } UPDATE
@ 6, 1 get oGet1 VAR ctestget size 100, 11
@ 9.95, 18.7 BUTTON "&Accept" OF oDlg ACTION (lSave := .t.) ;
SIZE 40, 12
@ 9.95, 25.7 BUTTON "&Exit" OF oDlg ACTION (oDlg:End()) SIZE 40, 12
ACTIVATE DIALOG oDlg CENTERED
if lSave
select test1
onerror("RLOCK")
if nValue = 1
replace msg1 with ctestget
elseif nValue = 2
replace msg2 with ctestget
else
replace msg3 with ctestget
endif
endif
close databases
return nil
*******************************************
function radiobtntest(nValue, oGet1)
if nValue = 1
ctestget = msg1
elseif nValue = 2
ctestget = msg2
else
ctestget = msg3
endif
oGet1:ReFresh()
return nil
********************************************
function createfilea()
// "File : test1.dbf"
tmpdbf:= {}
AAdd(tmpdbf, {"msg1", "c", 50, 0})
AAdd(tmpdbf, {"msg2", "c", 50, 0})
AAdd(tmpdbf, {"msg3", "c", 50, 0})
dbcreate("test1.dbf", tmpdbf)
close
*******************************************
function ONERROR
parameters errortype
errortype:= Upper(errortype)
do case
case errortype == "RLOCK"
if (RLock())
return .T.
endif
do while (!RLock())
InKey(3)
enddo
case errortype == "APPEND"
if (!neterr())
onerror("RLOCK")
return .T.
endif
do while (neterr())
InKey(3)
append blank
enddo
onerror("RLOCK")
endcase
return .T.
********************************
Thanks
Regards
ACWoo
Using FHW1201+Bcc582+Harbour