equivalent of text changed for option menus

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

equivalent of text changed for option menus

Post by jalz » Sat Sep 27, 2014 11:21 pm

Hi,

I've been using on text changed to enable buttons when a fields been modified. This was working great until I started to use an Option Menu. Is there a similar command I can use when someone changes the value in one of the menus I use?

Many thanks
Jalz

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: equivalent of text changed for option menus

Post by dunbarx » Mon Sep 29, 2014 3:17 pm

Hi.

I assume you mean a "ComboBox" button (not an "Option" button) where the user can type into the selected menu item.
The textChanged message works there just as well as anywhere. Make two buttons. The first one is a standard button with this in its script:

Code: Select all

on mouseUp
   put space & random(99) after  msg
end mouseUp
The second is a "ComboBox", with this in its script:

Code: Select all

on textchanged
   put the target &&  target
  send "mouseUp" to btn 1
end textchanged
Now start typing into any menuItem in the combo. The silly and useless info appears in msg. Well, the info is useless, but the idea is sound. A "Combo" is a hybrid LC object (a dataGrid's little brother?) a button that contains an embedded field. But that field, though a bit removed from ordinary access, is just a field, and can indeed be manipulated like any other if you know just a little about it. Now you do...

Craig Newman

Post Reply