little help with combo/option menus?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

little help with combo/option menus?

Post by mwieder » Sun Nov 10, 2019 3:04 am

I've been beating my head against the wall trying to fix bug report 22451 https://quality.livecode.com/show_bug.cgi?id=22451 here for the last couple of days. I've got code that *mostly* works, or at least would work if I could tell which line of the control is currently highlighted. The code is in button.cpp, and in particular I'm looking at lines 693 -> ~760.

tl;dr - selecting lines in a combo or option control by mouse works, by keyboard doesn't. The code as currently written ensures that the selection by keyboard will be empty. I can easily fix that by putting *something* in there, as for example the previous selection. There is also code to get the currently selected line, but you can't select a line by using the keyboard. I've tried setting the menuhistoryprop in the switch statement but that didn't have an effect, and I've gotten pretty good at hanging my linux desktop with the wrong invocations.

The MCButton class doesn't have a way that I have found to get the currently highlighted line, only the currently selected line. And doesn't seem to have a way to select a given line.

Any ideas?

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: little help with combo/option menus?

Post by bwmilby » Sun Nov 10, 2019 10:52 pm

Is that section of code only dealing with sub menus (CS_SUBMENU)? If so, then 792-811 handles other types. It would take me a bit to wrap my head around the variables in that block (entry and state mainly) and the constants that are used.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: little help with combo/option menus?

Post by mwieder » Sun Nov 10, 2019 11:24 pm

It's the kdown function, and I'm dealing with the XK_Down, XK_Up, and more importantly the XK_KP_Enter switch entries. I know how to get the label text and how to get the selected text/line/chunk, but I can't get the highlighted line, which is what the down arrow and up arrow keys set, but they don't actually select the line. And setting the menuhistory doesn't seem to help.

hint: if you're going to try this, use the setmenuhistoryprop() function, not setmenuhistory() - that one's guaranteed to hang the system.

The note for XK_KP_Enter says that t_pick should be empty if the menukdown function succeeded, but in that case using it for the selected result in the handlemenupick() function seems useless.

Locked

Return to “Engine Contributors”