Use codebox /codebox tags wrapped in []
Also, refer to Forum Codes
Here is an example using filters to prevent the user entering unwanted data (such as letters/characters):
Also, refer to Forum Codes
Here is an example using filters to prevent the user entering unwanted data (such as letters/characters):
' Listbox help for dalaware SuperStrict Local MyWindow:TGadget=CreateWindow(" My Tool Box V1.0", 350,120,400,400) 'the position of the toolbox in the mainwindow Local ListBox:TGadget=CreateListBox(50,50,290,20,MyWindow) 'the size of the listbox inside the toolbox window Local Label0:TGadget=CreateLabel("Working out Percentages",135,5,300,20,MyWindow) ' write text to te Main ToolBox window AddGadgetItem ListBox, " Formular : Value / by 100 x the percent your looking for" ' create a listbox and put text in to it Global Label1:TGadget=CreateLabel("Enter Value :",50,113,70,25,MyWindow) ' write text to te Main ToolBox window Local MyInput_1:TGadget=CreateTextField(135,110,85,20,MyWindow) ' a sort of Input Global Label_2:TGadget=CreateLabel("Enter Percent %:",50,173,85,20,MyWindow) ' write text to te Main ToolBox window Local MyInput_2:TGadget=CreateTextField(135,170,85,20,MyWindow) ' a sort of Input Global Label_3:TGadget=CreateLabel("The result is :",50,233,85,20,MyWindow) ' write text to te Main ToolBox window Local MyInput_3:TGadget=CreateTextField(135,230,85,20,MyWindow) ' a sort of Input 'Global Label1:TGadget=CreateLabel("Enter Value :",50,113,70,25,MyWindow) ' set the textfield filter routines SetGadgetFilter MyInput_1, MyInput_1_Filter SetGadgetFilter MyInput_2, MyInput_2_Filter Repeat WaitEvent() ''Print CurrentEvent.ToString() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_GADGETACTION Local v:Float=Float(TextFieldText(MyInput_1)) Local p:Int=Int(TextFieldText(MyInput_2)) SetGadgetText MyInput_3 , v/100.0*p End Select Forever ' for MyInput_1 - restrict input to "0123456789." Function MyInput_1_Filter:Int(event:TEvent, context:Object) Select Event.ID Case EVENT_KEYCHAR ' accept fullstop/period If event.data=46 Return True ' accept numbers 0 to 9 If event.data>=48 And event.data<=57 Return True End Select Return False End Function ' for MyInput_2 - restrict input to "0123456789" Function MyInput_2_Filter:Int(event:TEvent, context:Object) Select Event.ID Case EVENT_KEYCHAR ' accept numbers 0 to 9 If event.data>=48 And event.data<=57 Return True End Select Return False End Function