Code: Select all
StringEx::SetText(#String, "Background Text", StringEx::#Background)
Code: Select all
StringEx::SetText(#String, "Background Text", StringEx::#Background)
Code: Select all
; Floats: "0.00" or "0,000"
; Time: "00:00"
; Date: "0000/00/00" or "00.00.0000")
; Cash: "0,00€" or "$ 0.00"
; License number: "____:____:____:____"
Code: Select all
If ModuleEx::AddWindow(#Window, ModuleEx::#Tabulator|ModuleEx::#CursorEvent)
Debug "AddWindow(#Window, ...) OK"
If ModuleEx::AddGadget(#String, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#String, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringEx, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringEx, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringPW, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringPW, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringDel, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringDel, ...) OK" : EndIf
Else
Debug "AddWindow(#Window, ...) Failed"
EndIf
Code: Select all
CompilerIf #PB_Compiler_IsMainFile
XIncludeFile "ModuleEx.pbi"
CompilerEndIf
; (Then the full DeclareModule StringEx code)
;- ======== Module - Example ========
CompilerIf #PB_Compiler_IsMainFile
UsePNGImageDecoder()
#Window = 0
Enumeration 1
#String
#StringEx
#StringPW
#StringDel
#Font
#Popup
#Image
#Menu_Item1
#Menu_Item2
#Menu_Item3
#Menu_Item4
#Menu_Item5
EndEnumeration
LoadImage(#Image, "Delete.png")
If OpenWindow(#Window, 0, 0, 460, 60, "Window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
If CreatePopupMenu(#Popup)
MenuItem(#Menu_Item1, "Undo")
MenuBar()
MenuItem(#Menu_Item2, "Copy")
MenuItem(#Menu_Item3, "Cut")
MenuItem(#Menu_Item4, "Paste")
MenuBar()
MenuItem(#Menu_Item5, "Delete")
EndIf
;StringGadget(#String, 15, 19, 90, 20, "")
;SetGadgetAttribute(#String, #PB_String_MaximumLength, 5)
StringEx::Gadget(#String, 15, 19, 90, 20, "")
StringEx::Gadget(#StringEx, 120, 19, 90, 20, "AutoComplete", StringEx::#AutoComplete, #Window) ; StringEx::#ShowButton / StringEx::#Numeric / StringEx::#LowerCase / StringEx::#UpperCase / StringEx::#NotEditable / StringEx::#BorderLess
StringEx::AttachPopupMenu(#StringEx, #Popup)
;StringEx::SetAttribute(#StringEx, StringEx::#MaximumLength, 5)
StringEx::AddWords(#StringEx, "Default Define Declare Degree Debug AutoComplete")
StringEx::Gadget(#StringPW, 225, 19, 100, 20, "Password", StringEx::#Password|StringEx::#ShowButton, #Window)
;StringEx::SetAttribute(#StringPW, StringEx::#Padding, 6)
;StringEx::SetAttribute(#StringPW, StringEx::#MaximumLength, 10)
StringEx::Gadget(#StringDel, 340, 19, 100, 20, "", StringEx::#AutoResize|StringEx::#Right, #Window) ;
StringEx::AddButton(#StringDel, #Image)
StringEx::SetAutoResizeFlags(#StringDel, StringEx::#Width)
StringEx::SetText(#StringDel, "Delete Button", StringEx::#Background)
StringEx::SetInputMask(#StringDel, "0.00")
;StringEx::SetInputMask(#StringDel, "*.__$")
;StringEx::SetInputMask(#StringDel, "*,__ €")
;StringEx::SetInputMask(#StringDel, "__.__.____")
CompilerIf Defined(ModuleEx, #PB_Module)
StringEx::SetDynamicFont(#StringDel, "Arial", 8)
StringEx::FitText(#StringDel, 3, 3)
StringEx::SetAutoResizeFlags(#StringDel, StringEx::#Width|StringEx::#FitText)
;ModuleEx::SetTheme(ModuleEx::#Theme_Green)
CompilerEndIf
;DisableGadget(#String, #True)
;StringEx::Disable(#StringEx, #True)
;StringEx::SetAttribute(#StringPW, StringEx::#Corner, 4)
If ModuleEx::AddWindow(#Window, ModuleEx::#Tabulator|ModuleEx::#CursorEvent)
Debug "AddWindow(#Window, ...) OK"
If ModuleEx::AddGadget(#String, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#String, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringEx, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringEx, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringPW, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringPW, ...) OK" : EndIf
If ModuleEx::AddGadget(#StringDel, #Window, ModuleEx::#UseTabulator) : Debug "AddGadget(#StringDel, ...) OK" : EndIf
Else
Debug "AddWindow(#Window, ...) Failed"
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #StringEx
Select EventType()
Case #PB_EventType_Focus
Debug ">>> Focus"
Case #PB_EventType_LostFocus
Debug ">>> LostFocus"
Case StringEx::#EventType_Change
Debug ">>> Changed"
EndSelect
Case #StringDel
If EventType() = StringEx::#EventType_Button
StringEx::Clear(#StringDel)
EndIf
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case #Menu_Item1
StringEx::Undo(#StringEx)
Case #Menu_Item2
StringEx::Copy(#StringEx)
Case #Menu_Item3
StringEx::Cut(#StringEx)
Case #Menu_Item4
StringEx::Paste(#StringEx)
Case #Menu_Item5
StringEx::Delete(#StringEx)
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
CloseWindow(#Window)
EndIf
CompilerEndIf
Code: Select all
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #StringEx
Select EventType()
Case #PB_EventType_Focus
Debug ">>> Focus"
Case #PB_EventType_LostFocus
Debug ">>> LostFocus"
Case StringEx::#EventType_Change
Debug ">>> Changed"
EndSelect
Case #StringDel
If EventType() = StringEx::#EventType_Button
StringEx::Clear(#StringDel)
EndIf
EndSelect