Seite 1 von 1

[Module] ModuleEx - Mastermodul für Custom Gadgets

Verfasst: 02.04.2019 15:42
von Thorsten1867
ModuleEx - Mastermodul (all OS / 64Bit / DPI)

Verwaltung der Tabulator-Taste (Shortcut) innerhalb eines Fenster (#Tabulator)
  • Wechselt mittels Tabulator von einem Gadget zum nächsten Gadget bzw. überspringt dieses (#IgnoreTabulator).
  • Gibt die Tabulator-Taste vorübergehend frei, wenn das Gadget den Focus erhält (#UseTabulator).
Globales Cursor-Event (Thread) für alle Gadgets, die einen blinkenden Cursor benötigen (#CursorEvent)
  • BindEvent(ModulEx::#Event_Cursor, @_CursorDrawing(), WindowNum)
  • Cursor-Thread wird automatisch beendet, wenn das letzte Fenster geschlossen wird.
Einheitliche EventType-Konstanten für PostEvent(), um etwaige Konflikte mit unterschiedlichen Modulen zu vermeiden
  • PostEvent(#PB_Event_Gadget, WindowNum, GadgetNum, ModulEx::#EventType_Button)

Code: Alles auswählen

; ModuleEx::AddGadget()                - add a gadget for tabulator handling  (#UseTabulator|#IgnoreTabulator)
; ModuleEx::AddWindow()                - enables the tabulator handling for this window  (#Tabulator|#CursorEvent)
; ModuleEx::CursorFrequency()          - changes the cursor frequency (default: 600ms)
; ModuleEx::ExitCursorThread()         - exit cursor thread
; ModuleEx::Font()                     - similar to 'LoadFont()' (supports dynamic fonts)
; ModuleEx::FreeFonts()                - free dynamic font data
; ModuleEx::GetGadgetWindow()          - returns the number of the window in which the gadget is located
; ModuleEx::LoadTheme()                - load a theme for all supportet gadgets
; ModuleEx::RequiredFontSize()         - calculates the required font size
; ModuleEx::SetAttribute()             - [#Padding/#PaddingX/#PaddingY]
; ModuleEx::SetFont()                  - similar to 'SetGadgetFont()' (supports dynamic fonts)
; ModuleEx::SaveTheme()                - save current theme
; ModuleEx::SetColor()                 - change the theme color of all supported gadgets
; ModuleEx::SetTheme()                 - set a theme for all supportet gadgets
Beispiel für Verwendung innerhalb eigener Module:

Code: Alles auswählen

; Cursor event and EventTypes for PostEvent()

CompilerIf Defined(ModuleEx, #PB_Module)
    
    #Event_Cursor       = ModuleEx::#Event_Cursor
    #EventType_Button   = ModuleEx::#EventType_Button
    
CompilerElse
  
  Enumeration #PB_Event_FirstCustomValue
    ; .....
  EndEnumeration
  
  Enumeration #PB_EventType_FirstCustomValue
    ; .....
  EndEnumeration
  
CompilerEndIf
  
; Add Window and gadgets

CompilerIf Defined(ModuleEx, #PB_Module)

  If ModuleEx::AddWindow(Window, ModuleEx::#Tabulator|ModuleEx::#CursorEvent)
    ModuleEx::AddGadget(Gadget, Window, ModuleEx::#UseTabulator)
  EndIf
  
CompilerElse  
  
 ; .....
  
CompilerEndIf
Download: ModuleEx.pbi