I'm looking at (as a test) two edit controls, one contains a hex value, and one an ascii value
edit control 1 = 61
edit control 2 = a
I edit control 1 to say 62, I then convert hex 62 to an ascii character (b), then set the control text of control 2 to b.
But if I try it the other way round, my program gets stuck in a loop as they try to update each other constantly - how can I stop this?
Also, how do I stop the updating of controls whilst the window is created?
Thanks,
Andy.
I have got this far, just click between edit 1 and 2, edit 2 Shows a Count adding up, and edit 1 a Count counting down.
DEF w1 as WINDOW
int c,d
d = 100
OPENWINDOW w1,0,0,600,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Simple Window",&main
CONTROL w1,@EDIT,"",60,40,500,25,@CTEDITLEFT|@TABSTOP,1
CONTROL w1,@EDIT,"",60,80,500,25,@CTEDITLEFT|@TABSTOP,2
CONTROL w1,@button,"cancel",60,120,100,25,@CTEDITLEFT|@TABSTOP,4
WAITUNTIL w1 = 0
END
SUB main
SELECT @MESSAGE
CASE @IDCONTROL
select @CONTROLID
case 1
select @notifycode
case @enkillfocus
c ++
setcontroltext w1,2,str$(c)
endselect
case 2
select @notifycode
case @enkillfocus
d --
setcontroltext w1,1,str$(d)
endselect
endselect
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
CLOSEWINDOW w1
ENDSELECT
RETURN 0
ENDSUB
But I need to stop it updating the other edit Control when neither of the two controls have the Focus.
See if this does want you want you last example to do
$include "windowssdk.inc"
DEF w1 as WINDOW
int c,d
d = 100
OPENWINDOW w1,0,0,600,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Simple Window",&main
CONTROL w1,@EDIT,"",60,40,500,25,@CTEDITLEFT|@TABSTOP,1
CONTROL w1,@EDIT,"",60,80,500,25,@CTEDITLEFT|@TABSTOP,2
CONTROL w1,@button,"cancel",60,120,100,25,@CTEDITLEFT|@TABSTOP,4
WAITUNTIL w1 = 0
END
SUB main(),int
SELECT @MESSAGE
CASE @IDCONTROL
select @CONTROLID
case 1
select @notifycode
case @ENKILLFOCUS
c ++
checkit()
endselect
case 2
select @notifycode
case @ENKILLFOCUS
d --
checkit()
endselect
endselect
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
CLOSEWINDOW w1
ENDSELECT
RETURN 0
ENDSUB
sub checkit()
if GetFocus()=GETCONTROLHANDLE(w1,2)
setcontroltext w1,2,str$(c)
elseif GetFocus()=GETCONTROLHANDLE(w1,1)
setcontroltext w1,1,str$(d)
endif
return
endsub
Larry,
Thanks again, that works for me, and I have now finished (or so I think) editing binary with either hex values on the left, or Ascii values on the right.
Enter a hex value, and it updates the correcsponding Ascii character and vice versa.
See attached.
Andy.
:)