3DS MAX: 3ds Max Forum 3ds Max Tutorials

Problem with listbox eventhandler call

COW Forums : Autodesk 3ds Max

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Philipp Leibelt
Problem with listbox eventhandler call
on May 13, 2009 at 12:18:12 pm

Hello

I have a small problem with maxscript (2009) and I just dont know what is wrong :)

Eventhandlers of UI controls can be call by e.g.:
"someButton.pressed()".

But if I want to call the "selected" eventhandler of a listbox by:
"someListBox.selected()" or
"someListBox.selected 1"
maxscript throws an error that it needs a function but gets a string of the selected item.

But
"someListBox.selected"
should return the items name... the other code should call the eventhandler.

How can i call the "selected"-Event of a listBox?

Thanks


Return to posts index

Alejandro Martinez
Re: Problem with listbox eventhandler call
on Oct 28, 2015 at 12:55:21 am

Going to leave this non-elegant solution to this problem in the meantime:

- Create a function helper that you can call anytime you want, i.e. someListBox_selected item_idx function.
- if the actual someListBox.selected is called via mouse click inputs, just relay to your helper one.

sample:

-- Listbox event handling region:
fn someListBox_selected item_idx =
(
-- do something with item idx.
MessageBox ("Item selected on listbox: " + (item_idx as string))
)

on someListBox.selected item_idx do
(
-- Just relay
someListBox_selected item_idx
)

Reason for this years old post:
Was looking around for about an hour now for this exact same problem and this post appeared many times. If a better solution was found it would be nice to share it.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]