SOLVED - Drop Downs / Combo Boxes not working properly
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Drop Downs / Combo Boxes not working properly
Hi Mike,
I've prepared an improved (I hope) version, tackling some of the points you mentioned earlier. The "combo arrows" are now images which look more appropriate, and the scripts have been reworked to make it easier to reuse the group by a simple copy and paste. I've tried to include some explanation and comments in the scripts. It still is, it must be admitted, a work-around. I see that nothing misses Klaus's eagle eye, which is both reassuring and much appreciated.
Regards,
Michael
I've prepared an improved (I hope) version, tackling some of the points you mentioned earlier. The "combo arrows" are now images which look more appropriate, and the scripts have been reworked to make it easier to reuse the group by a simple copy and paste. I've tried to include some explanation and comments in the scripts. It still is, it must be admitted, a work-around. I see that nothing misses Klaus's eagle eye, which is both reassuring and much appreciated.
Regards,
Michael
- Attachments
-
- ComboBox for revLet2.zip
- (6.86 KiB) Downloaded 388 times
Re: Drop Downs / Combo Boxes not working properly
LOLRegulae wrote:... I see that nothing misses Klaus's eagle eye, which is both reassuring and much appreciated.

Yes, I am in the "eagle eye" business for almost 50 years!
Here is the proof:

Yep, that's me ca. 1962

Best
Klaus
Re: Drop Downs / Combo Boxes not working properly
Thank you. I will try it out and start using it in my projects. You guys are the best!Regulae wrote:Hi Mike,
I've prepared an improved (I hope) version, tackling some of the points you mentioned earlier. The "combo arrows" are now images which look more appropriate, and the scripts have been reworked to make it easier to reuse the group by a simple copy and paste. I've tried to include some explanation and comments in the scripts. It still is, it must be admitted, a work-around. I see that nothing misses Klaus's eagle eye, which is both reassuring and much appreciated.
Regards,
Michael
Mike
Re: Drop Downs / Combo Boxes not working properly
Hi Mike,
Good to know things are progressing. I see now my version 2 is could be greatly improved- getting some sleep has helped. Something I'll look at, or others may have better ideas. Still, from the point of view of your project, given the client requirement that makes revlet deployment necessary, and the design requirement that, to give users a convenient way of choosing from potentially long lists, the combo box is appropriate, the key thing is to quickly establish a way of doing it. You are then free to concentrate on other priorities, and refinements can be made at leisure. You mentioned earlier some other problems, concerning TAB key functioning and error checking. Naturally, keep posting to the Forum when you get stuck. As a LiveCoder, you have an international team behind you.
@Klaus
A truly wonderful photograph! There is the face of a young man clearly destined for LiveCode greatness! The eagle-eye is unmistakable. Thanks for posting it- it brought a big smile to my face.
Regards,
Michael
Good to know things are progressing. I see now my version 2 is could be greatly improved- getting some sleep has helped. Something I'll look at, or others may have better ideas. Still, from the point of view of your project, given the client requirement that makes revlet deployment necessary, and the design requirement that, to give users a convenient way of choosing from potentially long lists, the combo box is appropriate, the key thing is to quickly establish a way of doing it. You are then free to concentrate on other priorities, and refinements can be made at leisure. You mentioned earlier some other problems, concerning TAB key functioning and error checking. Naturally, keep posting to the Forum when you get stuck. As a LiveCoder, you have an international team behind you.
@Klaus
A truly wonderful photograph! There is the face of a young man clearly destined for LiveCode greatness! The eagle-eye is unmistakable. Thanks for posting it- it brought a big smile to my face.
Regards,
Michael
Re: Drop Downs / Combo Boxes not working properly
Hey Klausimausi - did you knock the wall down with your head? 

Re: Drop Downs / Combo Boxes not working properly
You bet, but my hairdo did not suffer at all from that! 

Re: Drop Downs / Combo Boxes not working properly
Thanks Mike.
Yes, I want to be able to tab from one field to the next. The database uses standard forms in Live Code and the normal way of using a database is to tab through the fields, in order. How do I accomplish this in Live Code?
Mike
Yes, I want to be able to tab from one field to the next. The database uses standard forms in Live Code and the normal way of using a database is to tab through the fields, in order. How do I accomplish this in Live Code?
Mike
Re: Drop Downs / Combo Boxes not working properly
Hi Mike,
There's a little bit to the tab question that I needed to explore. Pressing the tab key jumps the cursor from one text field to another, in the order of their partNumbers on the card. The tab key visits fields with lower partNumbers before those with higher partNumbers. If you are developing a layout over time, adding, moving and deleting fields, the resultant fields can have partNumbers that don't follow the top/down left/right order one ultimately wants. From memory, I think this was what was happening in the example you posted- tab jumped the cursor between fields in an unintended manner. I've written two handlers which, if placed in the stack script, reorder left/right/top/down the fields on a card. Type "retab" in the message box. It will reorder the fields on the card you are currently on, (I believe) in the manner desired. The original order can be restored with "restoretab". The reordering can be repeated as often as required during the layout and development process:
You will see I've included some variants- by default I have it reordering all fields whose autoTab is true. If a field's autoTab is true, after the user has typed text in a field, pressing return or enter will jump them to the next field (whereas normally, pressing return in a field puts you on the next line in the same field). This may be desirable in the layout you showed. There is a small "commented out" section which facilitates setting the autoTab of all the fields if you want to do so. You have to do what is appropriate for your design- sometimes I use some fields to act as purely visual elements, like coloured boxes and so forth, and as they are not intended for data entry, you don't want tab to jump to them. It's worth knowing that if you want a specific field to be ignored by tab (and return/enter if the autoTab property is in general use) you can do this by setting its traversalOn to false.
The "Retab" handler determines the new order of fields based on their topLefts, ordered from top of screen down, with fields having roughly the same topLeft "y" value (thus in a line across the screen), ordered left to right. For the layout you showed, this should be appropriate, but as we are relying on the topLeft, there are some field arrangements where you might have to specify the partNumber/layer number with a particular field's property inspector to get the result you want. I've included the Restoretab handler to help retrieve a layout that "Retab" fails to handle well. I hope this goes some way to addressing your tab requirements- if not, naturally ask further.
I've made progress with a more generally usable revlet-friendly combo box, which I'll post shortly.
Regards,
Michael
There's a little bit to the tab question that I needed to explore. Pressing the tab key jumps the cursor from one text field to another, in the order of their partNumbers on the card. The tab key visits fields with lower partNumbers before those with higher partNumbers. If you are developing a layout over time, adding, moving and deleting fields, the resultant fields can have partNumbers that don't follow the top/down left/right order one ultimately wants. From memory, I think this was what was happening in the example you posted- tab jumped the cursor between fields in an unintended manner. I've written two handlers which, if placed in the stack script, reorder left/right/top/down the fields on a card. Type "retab" in the message box. It will reorder the fields on the card you are currently on, (I believe) in the manner desired. The original order can be restored with "restoretab". The reordering can be repeated as often as required during the layout and development process:
Code: Select all
on Retab
set the numberFormat to "000"
repeat with i = 1 to the number of controls on this card
put return&(the id of control i) before restorationList
/* Only fields whose autoTab is true will be relayered. If you want all the fields on the card relayered,
uncomment the next line, and comment out the more restrictive AND variant. */
-- If word 1 of the name of control i = "field" then
/* If, using the above line, you also to set the autoTab of all the fields to "true", uncomment this next small section: */
-- If word 1 of the name of control i = "field" then
-- set the autoTab of control i to true
-- end if
if word 1 of the name of control i = "field" AND the autoTab of control i = "true" then
put (the id of control i)&&(the partNumber of control i) into control i
put (item 1 of the topLeft of control i) * 1 into topLeftX
put (item 2 of the topLeft of control i) * 1 into topLeftY
put (the id of control i)&","&topLeftY&","&topLeftX&return before controlList
end if
end repeat
/* remove leading return in restorationList before saving in custom property "the restoreList of current card"
The property is retrieved and used by the RestoreTab handler. */
delete line 1 in restorationList
set the restoreList of this card to restorationList
/* controls sorted in ascending Y values (down the screen) */
sort lines of controlList ascending by item 2 of each
/* Consider two fields side by side, we would normally want tab to take us from the left field to the right.
After the first sort, if the field on the right is even one pixel higher than the one on the left, it will be considered "first".
This next sort adjustment corrects the problem, allowing a margin of error (+/-10 pixels) in field placement. */
put controlList into newList
put 0 into setY
repeat with i = 2 to (the number of lines in controlList)
if abs((item 2 of line i of controlList) - (item 2 of line (i - 1) of controlList)) < 10 then
if setY = 0 then
put (item 2 of line i of controlList) into item 2 of line (i - 1) of newList
put (item 2 of line i of controlList) into setY
end if
if setY <> 0 then
put setY into item 2 of line i of newList
end if
end if
if abs((item 2 of line i of controlList) - (item 2 of line (i - 1) of controlList)) >= 10 then
put 0 into setY
end if
end repeat
sort lines of newList ascending by item 2 of each,item 3 of each
set the lockScreen to true
repeat for each line L in newList
set the partNumber of control id (item 1 of L) to the number of parts
end repeat
end Retab
on RestoreTab
set the lockScreen to true
put the restoreList of this card into restorationList
repeat for each line L in restorationList
if there is a control id L then
set the partNumber of control id L to 1
end if
end repeat
beep 1
end RestoreTab
The "Retab" handler determines the new order of fields based on their topLefts, ordered from top of screen down, with fields having roughly the same topLeft "y" value (thus in a line across the screen), ordered left to right. For the layout you showed, this should be appropriate, but as we are relying on the topLeft, there are some field arrangements where you might have to specify the partNumber/layer number with a particular field's property inspector to get the result you want. I've included the Restoretab handler to help retrieve a layout that "Retab" fails to handle well. I hope this goes some way to addressing your tab requirements- if not, naturally ask further.
I've made progress with a more generally usable revlet-friendly combo box, which I'll post shortly.
Regards,
Michael
Re: Drop Downs / Combo Boxes not working properly
Michael,
Thank you so much. You are AWESOME! I will get to work on this and let you know how it goes.
Mike
Thank you so much. You are AWESOME! I will get to work on this and let you know how it goes.
Mike
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Drop Downs / Combo Boxes not working properly
Regulae wrote:Hi Mike,
I've had a shot at implementing a "roll your own" version of the combo box, which seems to work in revLets. It's fairly simple, but does the job. See the attached stack.
Regards,
Michael
Nice!
Thanks for posting that example.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Drop Downs / Combo Boxes not working properly
And another thanks you for posting v2.Regulae wrote:Hi Mike,
I've prepared an improved (I hope) version, tackling some of the points you mentioned earlier. The "combo arrows" are now images which look more appropriate, and the scripts have been reworked to make it easier to reuse the group by a simple copy and paste. I've tried to include some explanation and comments in the scripts. It still is, it must be admitted, a work-around. I see that nothing misses Klaus's eagle eye, which is both reassuring and much appreciated.
Regards,
Michael
I feel like I'm spending more time on work arounds than I should.
Thanks for saving me this time.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.