Seite 1 von 1

BindEvent() wird ignoriert?

Verfasst: 09.01.2022 19:34
von Delle
Hallo,

weiß jemand warum hier die ShowPosition() nie aufgerufen wird?

Code: Alles auswählen

EnableExplicit

Enumeration
  
  #Position
  
EndEnumeration

Declare Start()
Declare ShowPosition()
Declare onExit()

Start()

Procedure Start()
  
  OpenWindow(0, 0, 0, 300, 100, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  
  TextGadget(#Position, 245, 70, 30, 20, "...")
  
  BindEvent(#PB_Event_Timer, @ShowPosition(), 0, 101)
  
  BindEvent(#PB_Event_CloseWindow, @onExit())
  
  Repeat : WaitWindowEvent(10) 
    
  ForEver
EndProcedure

Procedure ShowPosition()
  
  SetGadgetText(#Position, FormatDate("%ii:%ss", Date()))
  
EndProcedure


Procedure onExit()
  
  End
  
EndProcedure
Danke!

Re: BindEvent() wird ignoriert?

Verfasst: 09.01.2022 20:02
von jacdelad
Es gibt kein Objekt "101" und du erstellst keinen Timer.

Re: BindEvent() wird ignoriert?

Verfasst: 09.01.2022 21:05
von mk-soft
Missing

Code: Alles auswählen

  TextGadget(#Position, 205, 70, 60, 20, "...")
  
  AddWindowTimer(0, 101, 1000)
Bei Window Timer ist für BindEvent das Objekt die Timer ID (Nummer)

Re: BindEvent() wird ignoriert?

Verfasst: 09.01.2022 21:10
von Delle
Danke ihr beiden!

Die Hilfe gibt leider keine konkreten Infos her, ich dachte das geht auch ohne Timer (automatisch) ;)