Author Topic: Weird behaviour of __UI_ValueChanged. It is triggering twice  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

Offline mohai

  • Newbie
  • Posts: 20
    • View Profile
Weird behaviour of __UI_ValueChanged. It is triggering twice
« on: February 05, 2022, 09:16:18 am »
Hi all,

first of all, thank you to Felippe and all the developers for the great work with QB64 and InForm.

I think I found some bugs in list controls in InForm.

The event __UI_ValueChanged is triggered twice (maybe more) when an element in the list is chosen.
I mean, if you click on an element in a list (or dropdown list) or change the selected text with the cursor keys,
this event is supposed to be triggered only once, as list value is only changed once, but actually it does not.
The SUB is triggered two or more times.
Also, if any variable is changed after first run of the sub, its value is lost when it runs for the second time.

You can see in the attached program.

I am thinking of several solutions, but this bug is weird.


regards

FellippeHeitor

  • Guest
Re: Weird behaviour of __UI_ValueChanged. It is triggering twice
« Reply #1 on: February 05, 2022, 09:31:02 am »
Thank you for your kind words, @mohai.

And thank you for reporting the issue. I'll have a look at it and get back to you soon.

Offline mohai

  • Newbie
  • Posts: 20
    • View Profile
Re: Weird behaviour of __UI_ValueChanged. It is triggering twice
« Reply #2 on: February 07, 2022, 11:47:00 am »
Thank you.

I the mean time, I did a quick fix. Please check the attached example.
It is a variable that stores the selected item number in the list.
The variable MUST be placed as closest as it can to the "case" entry for the list control. If not, the ValueChanged sub will repeat, so this variable will revert to the old value.
I also included a checkbox to enable/disable the fix and a button to select item 1 in the lists, so you can see the difference between both procedures.