It is currently Fri Oct 30, 2020 8:18 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: [Module] StringEx (all OS)
PostPosted: Fri Dec 06, 2019 8:37 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Update: Background text added

Code:
StringEx::SetText(#String, "Background Text", StringEx::#Background)

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] StringEx (all OS)
PostPosted: Fri Dec 06, 2019 8:16 pm 
Online
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1786
Location: Uttoxeter, UK
@ Thorsten1867,
Excellent. :D
Thank you, very much.

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] StringEx (all OS)
PostPosted: Sat Dec 07, 2019 12:33 am 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 392
Location: Brisbane, Qld, Australia
Brilliant! Many thanks.

_________________
Mike
www.showcuesystems.com


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] StringEx (all OS)
PostPosted: Tue Dec 31, 2019 11:50 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Update: Input masks optimized

Code:
; 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: "____:____:____:____"

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] StringEx (all OS)
PostPosted: Sat Jul 25, 2020 9:07 am 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 392
Location: Brisbane, Qld, Australia
I can't get the tab key to skip to the next field. In the example code I've added calls to ModuleEx::AddWindow and ModuleEx::AddGadget as shown here:
Code:
     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
and the function calls are all successful. However, the tab key does not go to the next gadget but focus stays on the current string gadget. (BTW, I changed the #String gadget from a PB gadget to a StringEx gadget.)

Am I missing something? Here's the complete example with the above mods:
Code:
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

Compiling with PB 5.71 under Windows 10, 64-bit.

_________________
Mike
www.showcuesystems.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye