'Compileroption: "-s console"
#include "sGUI\sGUI.bas"
#include once "sGUI\SimpleGadget.bas"

screen 15,32

InitGFX

dim as EventHandle ptr event
event=CreateEventHandle

dim as Gadget ptr button1,button2
button1= AddSimpleGadget(event,10,10,200,20,"Ok")
button2= AddSimpleGadget(event,10,60,200,20,"Rename button1")
GadgetOn(button1,button2)

'Console öffnen für output
dim as integer ff=freefile
open cons for output as ff

do
  event->xSleep(1)
  if event->GADGETMESSAGE then
    select case event->GADGETMESSAGE
      case button1
        print #ff,"button1 wurde angeklickt"
      case button2
        print #ff,"button2 wurde angeklickt und button1 umbenannt"
        SetCaption (button1,"ist nicht mehr ok!")
    end select
  end if
loop until event->EXITEVENT

close ff

DestroyEventHandle (event)
end

/'
function AddSimpleGadget (event as EventHandle ptr,x as integer,y as integer,w as integer,h as integer,txt as string) as Gadget ptr
event   ein Zeiger zu einem EventHandle
x       Position in px
y       Position in px
w       Breite in px
h       Höhe in px
txt     Buttontext



sub SetCaption(gad as _Gadget ptr,txt as string)
setzt neuen Text
gad         Zeiger auf ein Control
txt         neuer Text


weitere Manipulationen mit GadgetOn,GadgetOff,GadgetSleep

'/

