spinbutton
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
spinbutton
Looking at the toolbox: am I right in thinking that I must create spinbuttons myself, from a text entry field and a vertical scrollbar?
Also not sure if there is a way to create one such control once, in a re-usable fashion.
Also not sure if there is a way to create one such control once, in a re-usable fashion.
Re: spinbutton
Hi Bernd,
pardon my ignorance, but what is a spinbutton?
pardon my ignorance, but what is a spinbutton?
Re: spinbutton
Klaus.
Do you think it is the old HC beachball?
Craig
Do you think it is the old HC beachball?
Craig
Re: spinbutton
Hi Craig,
maybe, not the sligthest idea
Hi Bernd,
could you please explain?
But maybe you mean "set cursor to busy"?
Best
Klaus
maybe, not the sligthest idea

Hi Bernd,
could you please explain?
But maybe you mean "set cursor to busy"?
Best
Klaus
Re: spinbutton
Hi,
Maeby "Spinner store* of René Micout on "Rev on line" is what Bernd want
Best regards
Jean-Marc
Maeby "Spinner store* of René Micout on "Rev on line" is what Bernd want
Best regards
Jean-Marc
https://alternatic.ch
Re: spinbutton
Well, I'm glad that I contributed to your amusement. I should have explained. By spinbutton, I refer to a text field designated for entry of numeric data, which is accompanied by a pair of up / down arrows for keyboard-less entry. Click the up button to increase the number shown in the edit field, click the down button to decrease the number, or just enter the desired number straight away.
This is the standard user interface tool for numeric data entry on many platforms. Some platforms also support non-numeric, but enumerated, data such as a list of the months of a year.
I admit spinbutton is a generalised term of my own making.
MFC calls it CSpinButtonCtrl
.NET calls it NumericUpDown
Swing calls it Spinner
Delphi calls it SpinEdit
(...)
I am pretty sure LiveCode does not support this construct, but by all means, please let me know if it does.
If LiveCode does not support such a control, the obvious next question would be how to create re-usable custom controls in LiveCode.
This is the standard user interface tool for numeric data entry on many platforms. Some platforms also support non-numeric, but enumerated, data such as a list of the months of a year.
I admit spinbutton is a generalised term of my own making.
MFC calls it CSpinButtonCtrl
.NET calls it NumericUpDown
Swing calls it Spinner
Delphi calls it SpinEdit
(...)
I am pretty sure LiveCode does not support this construct, but by all means, please let me know if it does.
If LiveCode does not support such a control, the obvious next question would be how to create re-usable custom controls in LiveCode.
Re: spinbutton
Hi Bernd,
from the toolbar you drag a "little arrow" object to the card and a text entry field. The little arrow object is technically a scrollbar. Place both objects side by side. You might want change the properties of the text entry field: lockText true, focusable or traversalOn to false (in preferences -> general -> first enty you can set what the properties inspector shows: either description of option or Name of liveCode property. I use the name of the livecode property then it is easier to remember the property for scripting. Anyways the other option will be in the tooltip) Obviously you would want to name your field, I was just lazy and scripted for field 1.
The script of the little arrow object is
I attach a little stack that shows this.
and welcome to the forum, now there are two Bernds on the forum and I am not alone anymore
Kind regards
Bernd
from the toolbar you drag a "little arrow" object to the card and a text entry field. The little arrow object is technically a scrollbar. Place both objects side by side. You might want change the properties of the text entry field: lockText true, focusable or traversalOn to false (in preferences -> general -> first enty you can set what the properties inspector shows: either description of option or Name of liveCode property. I use the name of the livecode property then it is easier to remember the property for scripting. Anyways the other option will be in the tooltip) Obviously you would want to name your field, I was just lazy and scripted for field 1.
The script of the little arrow object is
Code: Select all
on scrollbarLineInc
subtract 1 from field 1
end scrollbarLineInc
on scrollbarLineDec
add 1 to field 1
end scrollbarLineDec
and welcome to the forum, now there are two Bernds on the forum and I am not alone anymore

Kind regards
Bernd
Re: spinbutton
Thanks for the info. I figured that much. I take it that there is no way to create reusable custom controls?
I figure I can assign the name of the text field to a custom property of the scrollbar control ("little arrows"), which the scrollBarLineInc and scrollBarLineDec handlers could query. This would at least make the handler code generic (MFC calls this the "buddy control," but I forget if they make the scroll bar the buddy of the text control or vice versa). Other custom properties can be added to the text edit field for numeric minimum value, maximum value, position of decimal point, numeric base (radix), etc.
I have learned enough about LiveCode to do this once for one control. An application dealing with numeric input in such fashion often needs many instances of such a control.
The best I can think of right now is to create the whole thing dynamically, because this allows to define the templateScrollbar and templateField objects once, then create all instances dynamically. Of course, this is no longer RAD GUI development. To that end, I'd place a placeholder control (a button, a label, doesn't really matter) with a special attribute (a custom property or a magic name) on the card. That way, my spin control create handler can tell how many spin controls to create, where to put them, how to size them, and then remove the placeholder piece.
I think this will work for one stack.
It is reusable in other stacks to some extend (that is, if I remember all the little tricks such as the magic designators used with the placeholder controls). It's most certainly not state of the art.
I figure I can assign the name of the text field to a custom property of the scrollbar control ("little arrows"), which the scrollBarLineInc and scrollBarLineDec handlers could query. This would at least make the handler code generic (MFC calls this the "buddy control," but I forget if they make the scroll bar the buddy of the text control or vice versa). Other custom properties can be added to the text edit field for numeric minimum value, maximum value, position of decimal point, numeric base (radix), etc.
I have learned enough about LiveCode to do this once for one control. An application dealing with numeric input in such fashion often needs many instances of such a control.
The best I can think of right now is to create the whole thing dynamically, because this allows to define the templateScrollbar and templateField objects once, then create all instances dynamically. Of course, this is no longer RAD GUI development. To that end, I'd place a placeholder control (a button, a label, doesn't really matter) with a special attribute (a custom property or a magic name) on the card. That way, my spin control create handler can tell how many spin controls to create, where to put them, how to size them, and then remove the placeholder piece.
I think this will work for one stack.
It is reusable in other stacks to some extend (that is, if I remember all the little tricks such as the magic designators used with the placeholder controls). It's most certainly not state of the art.
Re: spinbutton
Hi Bernd,
what you describe could well be a library in Livecode. A library is a stack and the actual code library is in the stack script. You use your library by issuing a "start using stack "myLibraryStack". This way the stack script of your library stack will be in the message path and accessible.
Or have a look at Ken Ray's DropTools
http://droptools.sonsothunder.com/
That sounds a bit like what would be reusable objects.
His other site is also worth checking
http://www.sonsothunder.com/devres/live ... vecode.htm
lot of tips/tricks, although some of them a bit dated.
Kind regards
Bernd
what you describe could well be a library in Livecode. A library is a stack and the actual code library is in the stack script. You use your library by issuing a "start using stack "myLibraryStack". This way the stack script of your library stack will be in the message path and accessible.
Or have a look at Ken Ray's DropTools
http://droptools.sonsothunder.com/
That sounds a bit like what would be reusable objects.
His other site is also worth checking
http://www.sonsothunder.com/devres/live ... vecode.htm
lot of tips/tricks, although some of them a bit dated.
Kind regards
Bernd
Re: spinbutton
Hi Bernd,
actually there is a free "spinner" for use with dropTools
http://www.sixsides.it/index.php?menu_id=134&lang=eng
It looks the configurable numeric input field you want to do.
Kind regards
Bernd
actually there is a free "spinner" for use with dropTools
http://www.sixsides.it/index.php?menu_id=134&lang=eng
It looks the configurable numeric input field you want to do.
Kind regards
Bernd