[b];****
;Hier meine kleine Abwandlung des TUT. einfach einen editor öffnen C&P (hoffentlich geht die Formatierung nicht verloren mit Notepad ++ ging es)
;dann unter helmuth.hws im Scui lib -Ordner speichern abspeichern
; ALso in dem Ordner, in dem du SCUI LIB entpackt hast (die LHA Datei aus dem og. Link)
;****[/b]
;Viel Erfolg bei Fragen, Anregungen oder Kritik
;einfach........malsehn....
;
; Nur zur Ergänzung der Inhalt und ScuiLib Stammen von Fabio Falcucci aka Allanon (
hijoe@tin.it)
; -----------------------------------------------------------------------------
@INCLUDE "ScuiLib.hws"
; -----------------------------------------------------------------------------
@DISPLAY { Mode = "Fullscreen", Width = 1024, Height = 768, Title = "SCUI: für HelmutH abgewandelt das Tutorial 06 - StringBox für (auch) Eingabetext", Color = #BLACK }
; Here we define, as usual, the functions that we will link
; to the button events
Function PushedEvent()
scui.Set("StatusLabel", { Text = { Content = { Values = { "Maustaste wurde gedrückt!" }, Lines = 1 }}}, 1)
EndFunction
Function StringBox1_Change()
; Diese Funktion wird jedesmal aufgerufen, wenn die
; StringBox1 geändert !!!!!! wird.
Local sbox = scui.Get("StringBox1")
scui.Set("StatusLabel", { Text = { Content = { Values = { "Du hast jetzt die String Box geändert der Inhalt steckt in : [b]" ..sbox.Value.. "[/b] " }, Lines = 1 }}}, 1)
EndFunction
Function StringBox2_Exit()
; Diese Funktion wird jedesmal aufgerufen, wenn die
; in die string box durch ENTER oder durch Aktivierung
Local sbox = scui.Get("StringBox2")
scui.Set("StatusLabel", { Text = { Content = { Values = { "Die String Box wurde geändert -->" ..sbox.Value.. " alles aus der 2. String Box nochmal in fett: [b]" ..sbox.Value.. "[/b]" }, Lines = 1 }}}, 1)
EndFunction
; Old tutorials stuff
scui.NewObject( #IFOCLASS_BEVELBOX, "BGFrame", { x = 1, y = 1 }, { x = 1022, y = 766 } )
scui.NewObject( #IFOCLASS_LABEL, "Title", { x = 10, y = 10 }, { x = 1004, y = 70 },
{ Bevel = { Colors = { Fill1 = { r = 255, g = 255, b = 160} } },
Text = { FontName = "Diamond.font", FontSize = 12 , Alignment = #TEXTALIGN_CENTER } },
{ Values = { "SCUI: abgewandelt Tutorial 06 - StringBox für den Eingabetext - für den HelmutH " }, Lines = 1 } )
scui.NewObject( #IFOCLASS_LABEL, "Comment", { x = 12, y = 60 }, { x = 1000, y = 18 },
{ Text = { Alignment = #TEXTALIGN_CENTER } },
{ Values = { "Das könnte man auch Info-Box für das Programm nennen und wurde *drübergelegt*" }, Lines = 1 } )
scui.NewObject( #IFOCLASS_BUTTON, "SecondButton", { x = 12, y = 100 }, { x = 1002, y = 50 },
nil,
{ Values = { "Nochmal einfacher Button (UnPushed Event)", "Klick die Maus..." }, Lines = 2 },
{ OnPushed = PushedEvent } )
scui.NewObject( #IFOCLASS_BUTTON, "EndButton", { x = 10, y = 738 }, { x = 1004, y = 25 },
{ Bevel = { Height = 3,
Colors = { Fill1 = { r = 250, g = 250, b = 0 },
Fill2 = { r = 255, g = 0, b = 0 }}},
HBevel = { Colors = { Fill1 = { r = 250, g = 250, b = 250 },
Fill2 = { r = 250, g = 250, b = 0 }}}},
{ Values = { "Ein Klick und es geht raus..." }, Lines = 1 },
{ OnPushed = Function() End EndFunction } )
scui.NewObject( #IFOCLASS_LABEL, "StatusLabel", { x = 10, y = 155 }, { x = 1004, y = 20 },
{ Text = { Alignment = #TEXTALIGN_CENTER } },
{ Values = { "In dieser Box werden gleich ALLE Ergebnisse angezeigt" }, Lines = 1 } )
; Tutorial 06 starts here
; Let's build our first StringBox!
scui.NewObject( #IFOCLASS_STRINGBOX, ; StringBox class
"StringBox1", ; StringBox name
{ x = 10, y = 310 }, ; Position
{ x = 600, y = 20 }, ; Width & Height
nil, ; Visuals
{ Values = { "Tippe irgendetwas ein ---- dies ist Stringbox 1..." }, ; Starting Content
Lines = 1,
InputType = #GETKEY_ALL, ; Allowed character set
MaxLen = 255, ; Maximum string lenght
Clear1st = 1 }, ; Clear content at first activation
{ OnChange = StringBox1_Change } ) ; Event/Function assignment
; Another customized string box, this time we will set some properties
; at creation time and some properties using 'scui.Set' function.
scui.NewObject( #IFOCLASS_STRINGBOX, ; StringBox class
"StringBox2", ; StringBox name
{ x = 10, y = 335 }, ; Position
{ x = 600, y = 40 }, ; Width & Height
; Let's customize the 'normal' aspect of the gadget
{ Bevel = { Type = #BEVELTYPE_SIMPLE, ; Changes the bevel box type...
Height = 2, ; ...and its height
FillMode = #BEVELFILL_GRADIENT }}, ; finally changes the fillmode
{ Values = { "Erlaubt sind: abcdeABCDE AMIGA UND RESISTANCE!
" }, Lines = 1, ; Starting gadget content
InputType = #GETKEY_CUSTOM, ; Custom character set
Custom = "acbdeABCDEGRESITMN", ; Define the allowed characters(Buchstaben,(Wörter),Zahlen
MaxLen = 255 }, ; Max lenght = 255 characters
{ OnExit = StringBox2_Exit } ) ; Event assignment zu welchem Zeitpunkt
; Since we want to change the font to all aspects of the gadget (normal,
; hilight, pushed and disabled) we will use the command 'scui.Set' with the
; special tag 'AllTexts'.
scui.Set("StringBox2", { AllTexts = { FontName = "Diamond.font", ; Changes the font name
FontSize = 20 } }, 1) ; and the font size
; The 4th string box will accept only number related characters
scui.NewObject( #IFOCLASS_STRINGBOX,
"StringBox3",
{ x = 10, y = 380 },
{ x = 290, y = 20 },
nil,
{ Values = { "1234567890 " }, Lines = 1,
InputType = #GETKEY_NUMERIC, ; The only difference is here!
MaxLen = 255 },
nil ) ; Note that we have not set any event
; handling
; Change the alignment and the edge type
scui.Set("StringBox3", { AllTexts = { Alignment = #TEXTALIGN_RIGHT + TEXTALIGN_VCENTER ,
Edge = { Type = #TEXTEDGE_SIMPLE } } }, 1 )
; This is the last StringBox: only alphabetic related characters here
scui.NewObject( #IFOCLASS_STRINGBOX,
"StringBox4",
{ x = 310, y = 380 },
{ x = 300, y = 20 },
nil,
{ Values = { "ABCDEFGHIJKL interessant ist hier die Formatierung)" }, Lines = 1,
InputType = #GETKEY_ALPHABETIC,
MaxLen = 255 },
nil )
scui.Set("StringBox4", { AllTexts = { Alignment = #TEXTALIGN_CENTER,
Edge = { Type = #TEXTEDGE_3D } } }, 1 )
; Below there is a multiline label used to show the user
; how can interact with the String Boxes
scui.NewObject( #IFOCLASS_LABEL, "InfoLabel", { x = 620, y = 310 }, { x = 394, y = 90 },
{ Text = { Alignment = #TEXTALIGN_LEFT } },
{ Values = { " [u]Möglichkeiten innerhalb der STRING BOX : voreingestellte Werte[/u]",
" [b]Cursor Up[/b]: Der Cursor springt zum Anfang.",
" [b]Cursor Down[/b]: Der Cursor springt zum Ende",
" [b]Return[/b]: Änderungen werden akzeptiert und Beendigung des Control",
" [b]F1[/b]: Wechsel zwischen dem Modus überschreiben und einfügen",
" [b]Esc[/b]: Alle aktuellen Änderungen werden zurückgenommen" }, Lines = 6 } )
/*
COMMENTS
What we have seen:
- StringBox class
- How to change the default font of the string box
- Formatting characters
DETAILS
*** StringBox class ***
This IFO is used to build editable text boxes, you can customize many attributes
like font name, font size, colors, and so on.
Actually you can set one of this input filters (InputType tag):
- #GETKEY_ALL Accept almost all characters
- #GETKEY_NUMERIC Accept only numeric related characters
- #GETKEY_ALPHABETIC Accept alphabetic characters
- #GETKEY_CUSTOM Accept custom character defined used the tag 'custom'
This control can react to the following events:
- OnExit When the user exits from the String Box
- OnChange When the user has changed the String Box contents
- OnKeyPress At every character typed in the string box
*** How to change the default font of the string box ***
This is valid for the other complex IFOs too.
When you need to change an attribute to all graphic component like, for example,
the font name, you can use the function <scui.Set()> with the special tag <AllTexts>,
this is valid with BevelStruct too but you have to use the tag <AllBevels> to make
changes to all BevelStruct that are used to build the IFO.
*** Formatting Characters ***
Yes, you can use the Hollywood formatting characters within strings but actually
you can't use them within StringBoxes because they are not rendered but still
in the string and processed by the input routine.
This behaviour will be fixed in a future version of ScuiLib.
*/
Repeat
WaitEvent
Forever