[Gambas-user] Replace (Internal) Error Message

T Lee Davidson t.lee.davidson at gmail.com
Fri May 26 03:39:31 CEST 2023


On 5/25/23 06:22, Benoit Minisini wrote:
> Le 23/05/2023 à 13:26, Hans Lehmann a écrit :
>> Hello.
>>
>> When I use the following procedure:
>>
>> Public Sub dcFlowername_Validate(Value As Variant)
>>
>>       If IsNull(Value) Then
>>      '-- Message.Warning(Subst("&1<br>&2<b> &3 </b>&4", ("No flower name was entered!"), ("The data set is"), ("not"), 
>> ("saved!")))
>>      '-- An *internal* error message is displayed!
>>          Return
>>       Endif
>>
>> End
>>
>> the same meaningless error message "Invalid value" is always displayed.
>>
>> Is there a way to replace this internal error message with a meaningful error message of my own?
>>
>> With kind regards
>>
>> Hans
>>
> 
> Hi,
> 
> Commit https://gitlab.com/gambas/gambas/-/commit/d5910b61411eeeb8552163b290756a98be47ce4e should fulfill your needs:
> 
> DataSource now raises an 'Invalid' event when the value entered for a specific field is invalid.
> 
> The event handler takes the name of the invalid field as argument.
> 
> If that event is stopped, the default warning message is not displayed.
> 
> Regards,
> 

I was hoping you would come up with something like that, Benoît. It sounds like it should work quite well.

Since that enhancement is not yet in Stable, I cannot try it out. So, I have a question. Can LAST be used in the DataSource 
Invalid event handler? I can see that being useful if one wanted to point a balloon at the control with the invalid value.


-- 
Lee



More information about the User mailing list