PureBasic Forum
https://www.purebasic.fr/english/

[Module] ModuleEx - Mastermodul for custom gadgets
https://www.purebasic.fr/english/viewtopic.php?f=27&t=72571
Page 1 of 1

Author:  Thorsten1867 [ Tue Apr 02, 2019 2:58 pm ]
Post subject:  [Module] ModuleEx - Mastermodul for custom gadgets

ModuleEx - Mastermodul (all OS / 64Bit / DPI)

Management of the tab key (shortcut) within a window (#Tabulator)
  • Switches from one gadget to the next via tabulator or skips this gadget (#IgnoreTabulator).
  • Temporarily releases the tab key when the gadget gets the focus (#UseTabulator).

Global cursor event (thread) for all gadgets that need a blinking cursor (#CursorEvent)
  • BindEvent(ModulEx::#Event_Cursor, @_CursorDrawing(), WindowNum)
  • Cursor thread is automatically terminated when the last window is closed.

Uniform EventType constants for PostEvent() to avoid conflicts with different modules.
  • PostEvent(#PB_Event_Gadget, WindowNum, GadgetNum, ModulEx::#EventType_Button)

Code:
; ModuleEx::AddGadget()                - add a gadget for tabulator handling  (#UseTabulator|#IgnoreTabulator)
; ModuleEx::AddWindow()                - enables the tabulator handling and cursor event for this window  (#Tabulator|#CursorEvent)
; ModuleEx::CursorFrequency()          - changes the cursor frequency (default: 600ms)
; ModuleEx::ExitCursorThread()         - exit cursor thread


Example for use within own modules:
Code:
; 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

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/