#include <hmg.ch>
Function Main
define window sample at 0, 0 width 300 height 300 main
define combobox one
row 10
col 10
width 100
on lostfocus do_one()
end combobox
define textbox two
row 40
col 10
width 100
on lostfocus do_two()
end textbox
end window
sample.one.additem( 'One' )
sample.one.additem( 'Two' )
sample.center()
sample.activate()
Return
function do_one
if sample.one.value == 0
sample.one.setfocus()
endif
return nil
function do_two
if len( alltrim( sample.two.value ) ) == 0
sample.two.setfocus()
endif
return nil
While running, just press <tab> and the focus will move to the second control. But, I think it should be in the first control itself. Is this a bug?
East or West HMG is the Best. South or North HMG is worth.
...the possibilities are endless.
It is not a bug. You have commited a little mistake in your function do_two replace this line: sample.two.setfocus() by this sample.one.setfocus(). It was backing at same place, after two would pass to combobox one.
HMGing a better world "Matter tells space how to curve, space tells matter how to move." Albert Einstein
Please consider this sample.
...
While running, just press <tab> and the focus will move to the second control. But, I think it should be in the first control itself. Is this a bug?
Hi Rathi,
No, it isn't. You should correct your function do_two as showed in the updated sample below:
#include <hmg.ch>
Function Main
define window sample at 0, 0 width 300 height 300 main
define combobox one
row 10
col 10
width 100
on lostfocus do_one()
end combobox
define textbox two
row 40
col 10
width 100
on lostfocus do_two()
end textbox
end window
sample.one.additem( 'One' )
sample.one.additem( 'Two' )
sample.center()
sample.activate()
Return
function do_one
if sample.one.value == 0
sample.one.setfocus()
endif
return nil
function do_two
if len( alltrim( sample.two.value ) ) == 0 .and. sample.one.value != 0
sample.two.setfocus()
endif
return nil
Hope that helps
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein