Subject |
Re: combobox / msgbox |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Thu, 15 Feb 2024 12:26:41 +0200 |
Newsgroups |
dbase.getting-started |
On 2024/02/15 10:50, Michel wrote:
> Hello,
> I have the following issue :
> I have a combobox (style 1 DropDown) with and OnChange event like below :
>
> function MYCOMBOBOX_OnChange
> if form.myRowset.findkey(uper(this.value))
> // some code
> else
> msgbox("Not Found", "Check", 0 + 16)
> return
> endif
> return
>
> When entering wrong data (directly in the box, without opening it) and going to next field in the form by pressing TAB key, msgbox opens normally. But if going to next field by pressing ENTER key (CUAENTER is OFF), msgbox doesn't open (as if enter key was applied directly to the msgbox), and then I have no warning.
>
> What am I missing ?
> Michel
I'm afraid, based on the information given, I haven't been able to
reproduce the problem.
Keep in mind that the combobox's onChange event is only triggered if the
user actually changes the value displayed in the combobox's entryfield
either by typing in a value or by selecting a value from the dropdown
list. If the onChange event handler is not executed the message box
won't open.
A possible solution is to use the combobox's onGotFocus event handler to
remove any previous value so that the user must either type in a value
or select from the dropdown list.
You could use the the combobox's onLostFocus event handler to test for
an empty value and force focus back to the combobox until a value, valid
or not, has been entered.
function MYCOMBOBOX_onGotFocus
this.value= ''
return
function MYCOMBOBOX_onLostFocus
if empty(this.value)
this.setFocus()
endif
return
Mervyn
|
|