Source language: Translate to:

ListBox (Selection Changed)

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

ListBox (Selection Changed)

Postby TMcD » Fri Dec 09, 2011 3:48 pm

I'm using a ListBox and when I change the selection by selecting a new one with my cursor, the "Selection Changed" action works.

When I press a button that increments the variable used by the ListBox (the selection) the ListBox visibly changes, but the "Selection Changed" action does not seem to be triggered, which I thought it would be.

I'm not sure what to do. I did try refreshing the ListBox after the variable is incremented, but that does not trigger the "Selection Changed" action.

Again, I would think that incrementing the variable would constitute a "Selection Changed"... ?

Thanks,
Troy
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Postby aguilar955 » Fri Dec 09, 2011 8:55 pm

I can not find the problem

Image

Salu2
aguilar955
 
Posts: 85
Joined: Sat Jan 17, 2009 10:50 am

Postby TMcD » Fri Dec 09, 2011 9:08 pm

@aguilar955 Thanks for trying to help, but I can't tell if you are showing the actions of a selection change. (I can only see that the variable of the ListBox selection is changing.)

What I see in your animated video is that the variable of the ListBox selection is updated when using a [+] or [-] button, but I can't tell if you have an action being triggered when the selection is changed by a button. (And that is my issue.)
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Postby dec » Sat Dec 10, 2011 1:18 am

Hi,

I'am not sure, but, maybe the "Selection change" event is only fired when the list change... from the list, not from other control like a button. Assuming this, maybe you can take another possibles ways. For example, Suppose you place a "GoSub" action on the "Selection change" event. So the appropiate subroutine is executed. So, maybe is possible to execute the same subroutine from the button that change the listbox. In this way the same subroutine is finally executed.

I hope you can understand my idea. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby TMcD » Sat Dec 10, 2011 1:45 am

Yes, this is what I am wondering as well .... If the ListBox (Selection Change) is only triggered by an actual mouse change in the ListBox.

If that is the case then, that would be disappointing, as a "Selection Change" is a "Selection Change" to me. :)


dec wrote:Hi,

I'am not sure, but, maybe the "Selection change" event is only fired when the list change... from the list, not from other control like a button. Assuming this, maybe you can take another possibles ways. For example, Suppose you place a "GoSub" action on the "Selection change" event. So the appropiate subroutine is executed. So, maybe is possible to execute the same subroutine from the button that change the listbox. In this way the same subroutine is finally executed.

I hope you can understand my idea. ;)
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Postby Gaev » Sat Dec 10, 2011 5:02 am

Troy:
Yes, this is what I am wondering as well .... If the ListBox (Selection Change) is only triggered by an actual mouse change in the ListBox.
Yes ... a mouse or keyboard action ... by a (living breathing) user.

If that is the case then, that would be disappointing, as a "Selection Change" is a "Selection Change" to me.

1) think of it as "a Selection Change by a User" ... as opposed to one triggered by "a change to the Variable: (to store selected item)".

2) No need to be disappointed ... design your Application (for say ListBox1) like so ...

a) copy the current set of commands in the Selection Changed section of the ListBox to a subroutine ... let us call it Variable_Changed_ListBox1 ... make sure to add the Return command at the end of this subroutine.

b) in the Selection Changed section of ListBox1, place the command ...
Code: Select all
GoSub "Variable_Changed_ListBox1"

c) where ever in other parts of your application you had a command like ...
Code: Select all
SetVar "[ListBox1]" "abcd"
... follow it up with a ...
Code: Select all
GoSub "Variable_Changed_ListBox1"

Now, the same set of instructions will be triggered from both types of changes.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest