Coder Social home page Coder Social logo

gadgeteventex's Introduction

GadgetEventEx

GadgetEventEx-Module for SpiderBasic

SpiderBasic unterstützt (aus Kompatibilitätsgründen zu PureBasic) relativ wenig Gadget-Ereignisse. So feuert beispielsweise das TextGadget überhaupt keine und das StringGadget nur drei Events (#PB_EventType_Change, #PB_EventType_Focus und #PB_EventType_LostFocus).

Mit dem GadgetEventEx-Modul ist es möglich, alle in JavaScript verfügbaren Ereignisse einem Gadget zuzuordnen.

Code-Beispiel:

XIncludeFile "GadgetEventEx.sbi"

EnableExplicit

Enumeration
  #Window
  #StringGadget
  #TextGadget
  #ButtonGadget
EndEnumeration

Procedure HandleGadgetEventEx(e)
  
  Select EventGadget()
    Case #StringGadget
      Debug "Event from #StringGadget"
    Case #TextGadget
      Debug "Event from #TextGadget"
    Case #ButtonGadget
      Debug "Event from #ButtonGadget"
    Default
      Debug "Event from ???"
  EndSelect
  
  Debug "EventGadget(): " + EventGadget()
  Debug "EventTypeEx(): " + GadgetEventEx::EventTypeEx()
  Debug "-----"
  
EndProcedure


OpenWindow(#Window, 0, 0, 300, 300, "GadgetEventExDemo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

; -------------------

StringGadget(#StringGadget, 10, 10, 100, 20, "StringGadget")

; bind all possible events for a StringGadget:

GadgetEventEx::Bind(#StringGadget, @HandleGadgetEventEx()) 

; -------------------

TextGadget(#TextGadget, 10, 50, 100, 20, "TextGadget")

; bind all possible events for a TextGadget (you can also use #PB_EventTypeEx_All):

GadgetEventEx::Bind(#TextGadget, @HandleGadgetEventEx(), GadgetEventEx::#PB_EventTypeEx_All)

; unbind MouseMove- and PointerMove-Events:

GadgetEventEx::Unbind(#TextGadget, @HandleGadgetEventEx(), GadgetEventEx::#PB_EventTypeEx_Mousemove + "|" + GadgetEventEx::#PB_EventTypeEx_Pointermove)

; -------------------

ButtonGadget(#ButtonGadget, 10, 80, 100, 25, "ButtonGadget")

; bind left- and right-click events for the ButtonGadget:

GadgetEventEx::Bind(#ButtonGadget, @HandleGadgetEventEx(), GadgetEventEx::#PB_EventTypeEx_Click + "|" + GadgetEventEx::#PB_EventTypeEx_Contextmenu)

Lizenz

MIT

gadgeteventex's People

Contributors

spiderbytes avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.