Seite 1 von 2

mir unbekannter fehler

Verfasst: 14.03.2007 13:05
von Tsuki-Namida
Hallo,
ich habe für meiner Webseite ein kleines Tool geschrieben.
In diesem Tool kann man mehere Dateiverzeichnisse auswählen und nach dem Bestätigen werden dann die dateien vom Server in die entsprechenden verzeichnisse kopiert.

wenn ich das Standart Verzeichnis lasse (C:\) geht das ja wunderbar nach dem ich auch "OK" geklickt habe ändere ich aber das verzeichnis egal wo zum beispiel in "C:\Neuer Ordner\" dann geht der OK button nur wenn ich es manuell in den "StringGadget" eingegeben habe. Suche ich das verzeichniss gehen die button's nicht mehr.
als Button habe ich einfach nur "ImageGadget" genollen da mit der ButtonImageGadget nicht gefällt...

Ich hoffe das ich das verständlich genug erklärt habe andernfals bitte einfach nachfragen...
hier der Quelltext:

Code: Alles auswählen

Enumeration
  #Window_0
  #Window_2
EndEnumeration

Enumeration
  #download
  #abbrechen
  #ok
  #String_wallpaper
  #String_boot
  #String_loggon
  #String_icon
  #button_wallpaper
  #button_boot
  #button_loggon
  #button_icon
EndEnumeration

UsePNGImageDecoder()

Global Image0
Global Image1
Global Image2
Global Image3
Global Image4

Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
Image2 = CatchImage(2, ?Image2)
Image3 = CatchImage(3, ?Image3)
Image4 = CatchImage(4, ?Image4)

DataSection
Image0:
  IncludeBinary "IMG\logo.bmp"
Image1:
  IncludeBinary "IMG\hg.bmp"
Image2:
  IncludeBinary "IMG\donwload.jpg"
Image3:
  IncludeBinary "IMG\abbrechen.jpg"
Image4:
  IncludeBinary "IMG\ok.jpg"
EndDataSection

Procedure LogoWindow()
hWnd    = OpenWindow(#Window_0, 0, 0, 500, 100, #PB_Window_ScreenCentered|#PB_Window_BorderLess ,"")
hBitmap = Image0
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_0))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_0),#GWL_HWNDPARENT,WindowID(notused))
EndProcedure

Procedure SetupWindow()
hWnd    = OpenWindow(#Window_2, 0, 0, 500, 400, #PB_Window_ScreenCentered|#PB_Window_BorderLess, "Tears Theme Loader")
hBitmap = Image1
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_2))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_2),#GWL_HWNDPARENT,WindowID(notused))
ImageGadget(#download,25,40,183,13,Image2)
ImageGadget(#abbrechen,125,375,108,13,Image3)
ImageGadget(#ok,342,375,29,13,Image4)
StringGadget(#String_wallpaper,25,155,170,20,"C:\")
StringGadget(#String_boot,25,220,170,20,"C:\")
StringGadget(#String_loggon,25,280,170,20,"C:\")
StringGadget(#String_icon,25,340,170,20,"C:\")
ButtonGadget(#button_wallpaper,195,155,20,20,"...")
ButtonGadget(#button_boot,195,220,20,20,"...")
ButtonGadget(#button_loggon,195,280,20,20,"...")
ButtonGadget(#button_icon,195,340,20,20,"...")
EndProcedure

Procedure StatusWindow()
  If OpenWindow(0,0,0,500,70,#PB_Window_ScreenCentered,"Laden der Dateien") And CreateGadgetList(WindowID(0))
    TextGadget(0,10,10,480,20,"")
    TextGadget(1,10,40,480,20,"")
  EndIf
EndProcedure

Procedure SetText(von.s, nach.s)
  SetGadgetText(0,von.s)
  SetGadgetText(1,nach.s)
EndProcedure

;LogoWindow()
;Delay(5000)
CloseWindow(#Window_0)
SetupWindow()
Repeat
  Event = WaitWindowEvent()
  
  WindowID = EventWindowID()
  
  GadgetID = EventGadgetID()
  
  EventType = EventType()
  
  If Event = #PB_EventGadget
  
    If GadgetID = #button_wallpaper
;{
      If OpenWindow(0,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper") And CreateGadgetList(WindowID(0))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
        ButtonGadget(1,5,265,90,20,"Abbrechen")
        ButtonGadget(2,100,265,90,20,"OK")
      EndIf
      Repeat
        Event = WaitWindowEvent()
        WindowID = EventWindowID()
        GadgetID = EventGadgetID()
        EventType = EventType()
        If Event = #PB_EventGadget            
          If GadgetID = 2
            SetGadgetText(#String_wallpaper, GetGadgetText(0))
            ok = 1
          EndIf
        EndIf 
      Until GadgetID = 1 Or ok = 1
      CloseWindow(0)
      ok = 0
;}      
    ElseIf GadgetID = #button_boot
;{
      If OpenWindow(0,0,0,300,300,#PB_Window_ScreenCentered,"Bootscreen") And CreateGadgetList(WindowID(0))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_boot) ,#PB_Explorer_NoFiles)
        ButtonGadget(1,5,265,90,20,"Abbrechen")
        ButtonGadget(2,100,265,90,20,"OK")
      EndIf
      Repeat
        Event = WaitWindowEvent()
        WindowID = EventWindowID()
        GadgetID = EventGadgetID()
        EventType = EventType()
        If Event = #PB_EventGadget            
          If GadgetID = 2
            SetGadgetText(#String_boot, GetGadgetText(0))
            ok = 1
          EndIf
        EndIf 
      Until GadgetID = 1 Or ok = 1
      CloseWindow(0)
      ok = 0
;}            
    ElseIf GadgetID = #button_loggon
;{
      If OpenWindow(0,0,0,300,300,#PB_Window_ScreenCentered,"Loggonscreen") And CreateGadgetList(WindowID(0))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_loggon) ,#PB_Explorer_NoFiles)
        ButtonGadget(1,5,265,90,20,"Abbrechen")
        ButtonGadget(2,100,265,90,20,"OK")
      EndIf
      Repeat
        Event = WaitWindowEvent()
        WindowID = EventWindowID()
        GadgetID = EventGadgetID()
        EventType = EventType()
        If Event = #PB_EventGadget            
          If GadgetID = 2
            SetGadgetText(#String_loggon, GetGadgetText(0))
            ok = 1
          EndIf
        EndIf 
      Until GadgetID = 1 Or ok = 1
      CloseWindow(0)
      ok = 0
;}         
    ElseIf GadgetID = #button_icon
;{
      If OpenWindow(0,0,0,300,300,#PB_Window_ScreenCentered,"System Icons") And CreateGadgetList(WindowID(0))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_icon) ,#PB_Explorer_NoFiles)
        ButtonGadget(1,5,265,90,20,"Abbrechen")
        ButtonGadget(2,100,265,90,20,"OK")
      EndIf
      Repeat
        Event = WaitWindowEvent()
        WindowID = EventWindowID()
        GadgetID = EventGadgetID()
        EventType = EventType()
        If Event = #PB_EventGadget            
          If GadgetID = 2
            SetGadgetText(#String_icon, GetGadgetText(0))
            ok = 1
          EndIf
        EndIf 
      Until GadgetID = 1 Or ok = 1
      CloseWindow(0)
      ok = 0
;}         
    ElseIf GadgetID = #download
      RunProgram("http://www.chip.de/downloads/c1_downloads_13003046.html","","")
    ElseIf GadgetID = #abbrechen
      End
    ElseIf GadgetID = #ok
      Debug "Okay Button"
    EndIf
  EndIf

Until Event = #PB_Event_CloseWindow
PS: Danke schon mal für Eure hilfe....

Verfasst: 14.03.2007 13:14
von ts-soft
Ändere mal den Titel, hier wird nicht geheult.

Deine ganzen EventLoops in einer EventLoop :freak: , was soll das sein?

Mach mal ein EventLoop draus, wo Du nach EventWindow() unterscheidest
und mit IsWindow, bzw. IsGadget die Existens überprüfst.

Dein Konstrukt wird niemals sauber laufen können.

Verfasst: 14.03.2007 13:33
von Tsuki-Namida
okay ich habe jetzt umgebaut auf dein vorschlag hin....

Code: Alles auswählen

Enumeration
  #Window_0
  #Window_2
  #verzeichnis
EndEnumeration

Enumeration
  #download
  #abbrechen
  #ok
  #String_wallpaper
  #String_boot
  #String_loggon
  #String_icon
  #button_wallpaper
  #button_boot
  #button_loggon
  #button_icon
  #button_vabbrechen
  #button_vok
EndEnumeration

UsePNGImageDecoder()

Global Image0
Global Image1
Global Image2
Global Image3
Global Image4

Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
Image2 = CatchImage(2, ?Image2)
Image3 = CatchImage(3, ?Image3)
Image4 = CatchImage(4, ?Image4)

DataSection
Image0:
  IncludeBinary "IMG\logo.bmp"
Image1:
  IncludeBinary "IMG\hg.bmp"
Image2:
  IncludeBinary "IMG\donwload.jpg"
Image3:
  IncludeBinary "IMG\abbrechen.jpg"
Image4:
  IncludeBinary "IMG\ok.jpg"
EndDataSection

Procedure LogoWindow()
hWnd    = OpenWindow(#Window_0, 0, 0, 500, 100, #PB_Window_ScreenCentered|#PB_Window_BorderLess ,"")
hBitmap = Image0
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_0))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_0),#GWL_HWNDPARENT,WindowID(notused))
EndProcedure

Procedure SetupWindow()
hWnd    = OpenWindow(#Window_2, 0, 0, 500, 400, #PB_Window_ScreenCentered|#PB_Window_BorderLess, "Tears Theme Loader")
hBitmap = Image1
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_2))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_2),#GWL_HWNDPARENT,WindowID(notused))
ImageGadget(#download,25,40,183,13,Image2)
ImageGadget(#abbrechen,125,375,108,13,Image3)
ImageGadget(#ok,342,375,29,13,Image4)
StringGadget(#String_wallpaper,25,155,170,20,"C:\")
StringGadget(#String_boot,25,220,170,20,"C:\")
StringGadget(#String_loggon,25,280,170,20,"C:\")
StringGadget(#String_icon,25,340,170,20,"C:\")
ButtonGadget(#button_wallpaper,195,155,20,20,"...")
ButtonGadget(#button_boot,195,220,20,20,"...")
ButtonGadget(#button_loggon,195,280,20,20,"...")
ButtonGadget(#button_icon,195,340,20,20,"...")
EndProcedure

Procedure StatusWindow()
  If OpenWindow(0,0,0,500,70,#PB_Window_ScreenCentered,"Laden der Dateien") And CreateGadgetList(WindowID(0))
    TextGadget(0,10,10,480,20,"")
    TextGadget(1,10,40,480,20,"")
  EndIf
EndProcedure

Procedure SetText(von.s, nach.s)
  SetGadgetText(0,von.s)
  SetGadgetText(1,nach.s)
EndProcedure

;LogoWindow()
;Delay(5000)
CloseWindow(#Window_0)
SetupWindow()
Repeat
  Event = WaitWindowEvent()
  
  WindowID = EventWindowID()
  
  GadgetID = EventGadgetID()
  
  EventType = EventType()
  
  If Event = #PB_EventGadget
  
    If GadgetID = #button_wallpaper
;{
      If OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper") And CreateGadgetList(WindowID(#verzeichnis))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
        ButtonGadget(#button_vabbrechen,5,265,90,20,"Abbrechen")
        ButtonGadget(#button_vok,100,265,90,20,"OK")
      EndIf
      wallpaper = 1
;}
    ElseIf GadgetID = #button_boot
;{
      If OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper") And CreateGadgetList(WindowID(#verzeichnis))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
        ButtonGadget(#button_vabbrechen,5,265,90,20,"Abbrechen")
        ButtonGadget(#button_vok,100,265,90,20,"OK")
      EndIf
      boot = 1
;}
    ElseIf GadgetID = #button_loggon
;{
      If OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper") And CreateGadgetList(WindowID(#verzeichnis))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
        ButtonGadget(#button_vabbrechen,5,265,90,20,"Abbrechen")
        ButtonGadget(#button_vok,100,265,90,20,"OK")
      EndIf
      loggon = 1
;}
    ElseIf GadgetID = #button_icon
;{
      If OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper") And CreateGadgetList(WindowID(#verzeichnis))
        ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
        ButtonGadget(#button_vabbrechen,5,265,90,20,"Abbrechen")
        ButtonGadget(#button_vok,100,265,90,20,"OK")
      EndIf
      icon = 1
;}
    ElseIf GadgetID = #download
      RunProgram("http://www.chip.de/downloads/c1_downloads_13003046.html","","")
    ElseIf GadgetID = #abbrechen
      End
    ElseIf GadgetID = #ok
      Debug "OK Button okay"
      End
    ElseIf GadgetID = #button_vabbrechen
      CloseWindow(#verzeichnis)
      wallpaper = 0
      boot = 0
      loggon = 0
      icon = 0
    ElseIf GadgetID = #button_vok
      If wallpaper = 1
        SetGadgetText(#String_wallpaper, GetGadgetText(0))
        CloseWindow(#verzeichnis)
      ElseIf boot = 1
        SetGadgetText(#String_boot, GetGadgetText(0))
        CloseWindow(#verzeichnis)
      ElseIf loggon = 1
        SetGadgetText(#String_loggon, GetGadgetText(0))
        CloseWindow(#verzeichnis)        
      ElseIf icon = 1
        SetGadgetText(#String_icon, GetGadgetText(0))
        CloseWindow(#verzeichnis)                
      EndIf
      wallpaper = 0
      boot = 0
      loggon = 0
      icon = 0      
    EndIf
  EndIf

Until Event = #PB_Event_CloseWindow
das problem jetzt finde ich eigentlich für unwarscheinlich.....

wenn ich

Code: Alles auswählen

If GadgetID = #button_wallpaper
oder

Code: Alles auswählen

If GadgetID = #button_boot
oder

Code: Alles auswählen

If GadgetID = #button_loggon
oder

Code: Alles auswählen

If GadgetID = #button_icon
benutze aktiviert sich auch gleich

Code: Alles auswählen

ElseIf GadgetID = #download
aber auch wenn ich eine aktion in diesem Fenster

Code: Alles auswählen

OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,"Wallpaper")
mache aktiviert sich ebenfals die abfrage....

Code: Alles auswählen

ElseIf GadgetID = #download
Was ist da schief gelaufen......

Verfasst: 14.03.2007 13:36
von Kiffi
Das ist (entgegen Deiner Signatur) PB3.94-Code. Den kann ich nicht testen.

Verfasst: 14.03.2007 13:42
von Kaeru Gaman
also, so mit elseif gadgetid is mir das nich so koscher...

du solltest obendrüber erstmal nach fenstern unterscheiden.
innerhalb jedes fenster-cases kannst du dann die gadgets desjenigen fensters testen.
alles andere ist fishy.

schau dir mal diese grundstruktur an:
http://www.purebasic.fr/english/viewtop ... 031#175031

Verfasst: 14.03.2007 13:46
von ts-soft
Proceduren noch einrücken, Titel nochmal ändern und hinzuschreiben, das
es sich um PB3.94 Code handelt.

Wenn Du es nicht vernünftig kannst, üben wir im Mülleimer weiter.

Am besten erstellste einzelne Prozeduren in denen Du die Fenster öffnest, das macht es Übersichtlicher.

Ansonsten bin ich raus, hab kein PB3.94 mehr

Verfasst: 14.03.2007 14:22
von Tsuki-Namida
okay ich habe es etwas abgeändert....
aber das ich beim suchen eines Verzeichnisses sich denn noch ein weiterer butte aktiwiert ist mir weiterhin unklar....

Code: Alles auswählen

Enumeration
  #Window_0
  #Window_2
  #verzeichnis
EndEnumeration

Enumeration
  #download
  #abbrechen
  #ok
  #String_wallpaper
  #String_boot
  #String_loggon
  #String_icon
  #button_wallpaper
  #button_boot
  #button_loggon
  #button_icon
  #button_vabbrechen
  #button_vok
EndEnumeration

UsePNGImageDecoder()

Global Image0
Global Image1
Global Image2
Global Image3
Global Image4

Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
Image2 = CatchImage(2, ?Image2)
Image3 = CatchImage(3, ?Image3)
Image4 = CatchImage(4, ?Image4)

DataSection
Image0:
  IncludeBinary "IMG\logo.bmp"
Image1:
  IncludeBinary "IMG\hg.bmp"
Image2:
  IncludeBinary "IMG\donwload.jpg"
Image3:
  IncludeBinary "IMG\abbrechen.jpg"
Image4:
  IncludeBinary "IMG\ok.jpg"
EndDataSection

Procedure LogoWindow()
hWnd    = OpenWindow(#Window_0, 0, 0, 500, 100, #PB_Window_ScreenCentered|#PB_Window_BorderLess ,"")
hBitmap = Image0
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_0))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_0),#GWL_HWNDPARENT,WindowID(notused))
EndProcedure

Procedure SetupWindow()
hWnd    = OpenWindow(#Window_2, 0, 0, 500, 400, #PB_Window_ScreenCentered|#PB_Window_BorderLess, "Tears Theme Loader")
hBitmap = Image1
SkinWin(hWnd, hBitmap)
CreateGadgetList(WindowID(#Window_2))
notused = OpenWindow(#PB_Any,0,0,0,0,#PB_Window_Invisible,"")
SetWindowLong_(WindowID(#Window_2),#GWL_HWNDPARENT,WindowID(notused))
ImageGadget(#download,25,40,183,13,Image2)
ImageGadget(#abbrechen,125,375,108,13,Image3)
ImageGadget(#ok,342,375,29,13,Image4)
StringGadget(#String_wallpaper,25,155,170,20,"C:\")
StringGadget(#String_boot,25,220,170,20,"C:\")
StringGadget(#String_loggon,25,280,170,20,"C:\")
StringGadget(#String_icon,25,340,170,20,"C:\")
ButtonGadget(#button_wallpaper,195,155,20,20,"...")
ButtonGadget(#button_boot,195,220,20,20,"...")
ButtonGadget(#button_loggon,195,280,20,20,"...")
ButtonGadget(#button_icon,195,340,20,20,"...")
EndProcedure

Procedure StatusWindow()
  If OpenWindow(0,0,0,500,70,#PB_Window_ScreenCentered,"Laden der Dateien") And CreateGadgetList(WindowID(0))
    TextGadget(0,10,10,480,20,"")
    TextGadget(1,10,40,480,20,"")
  EndIf
EndProcedure

Procedure VerzeichnisWindow(titel.s)
  If OpenWindow(#verzeichnis,0,0,300,300,#PB_Window_ScreenCentered,titel.s) And CreateGadgetList(WindowID(#verzeichnis))
    ExplorerTreeGadget(0, 5, 5, 280, 260, GetGadgetText(#String_wallpaper) ,#PB_Explorer_NoFiles)
    ButtonGadget(#button_vabbrechen,5,265,90,20,"Abbrechen")
    ButtonGadget(#button_vok,100,265,90,20,"OK")
  EndIf
EndProcedure

Procedure SetText(von.s, nach.s)
  SetGadgetText(0,von.s)
  SetGadgetText(1,nach.s)
EndProcedure

;LogoWindow()
;Delay(5000)
CloseWindow(#Window_0)
SetupWindow()
Repeat
  Event = WaitWindowEvent()
 
  WindowID = EventWindowID()
 
  GadgetID = EventGadgetID()
 
  EventType = EventType()
 
  If Event = #PB_EventGadget
 
    If GadgetID = #button_wallpaper
      VerzeichnisWindow("Wallpaper")
      wallpaper = 1

    ElseIf GadgetID = #button_boot
      VerzeichnisWindow("Bootscreen")
      boot = 1

    ElseIf GadgetID = #button_loggon
      VerzeichnisWindow("Loggonscreen")
      loggon = 1

    ElseIf GadgetID = #button_icon
      VerzeichnisWindow("Icon Set")
      icon = 1

    ElseIf GadgetID = #download
      RunProgram("http://www.chip.de/downloads/c1_downloads_13003046.html","","")
    ElseIf GadgetID = #abbrechen
      End
    ElseIf GadgetID = #ok
      Debug "OK ist okay"
      End
    EndIf
    If WindowID = #verzeichnis
      If GadgetID = #button_vabbrechen
        CloseWindow(#verzeichnis)
        wallpaper = 0
        boot = 0
        loggon = 0
        icon = 0
      ElseIf GadgetID = #button_vok
        If wallpaper = 1
          SetGadgetText(#String_wallpaper, GetGadgetText(0))
          CloseWindow(#verzeichnis)
        ElseIf boot = 1
          SetGadgetText(#String_boot, GetGadgetText(0))
          CloseWindow(#verzeichnis)
        ElseIf loggon = 1
          SetGadgetText(#String_loggon, GetGadgetText(0))
          CloseWindow(#verzeichnis)       
        ElseIf icon = 1
          SetGadgetText(#String_icon, GetGadgetText(0))
          CloseWindow(#verzeichnis)               
        EndIf
        wallpaper = 0
        boot = 0
        loggon = 0
        icon = 0     
      EndIf
    
    EndIf
  EndIf

Until Event = #PB_Event_CloseWindow

Verfasst: 14.03.2007 14:31
von Kaeru Gaman
vor deinen GadgetIDs überprüfst du immer noch nicht die WindowID...
schau dir doch mein beispiel wenigstens mal an.

Verfasst: 14.03.2007 14:38
von Tsuki-Namida
das habe ich getahn....

Ich habe es auch jetzt gemacht ;) und es geht danke an allen

Verfasst: 14.03.2007 14:44
von ts-soft
Du verwendest ein Fenster 0, sowie eins mit einer Konstanten, die den Wert 0 hat, das geht nicht. Dasselbe gilt für die Gadgets. Konstanten und Zahlen
durcheinander, diese sind dann doppelt vergeben.

Dein EventLoop sollte in etwa so aussehen: (nur grober Vorschlag)

Code: Alles auswählen

Repeat
  Event = WaitWindowEvent()
 
  WindowID = EventWindowID()
 
  GadgetID = EventGadgetID()
 
  EventType = EventType()
  
  Select WindowID
    Case #Window_0
      If Event = #PB_Event_CloseWindow : Break : EndIf ; Hauptfenster wurde geschlossen, ende
      
      Select GadgetID
        Case #ok
      EndSelect
    Case #Window_2
  EndSelect
ForEver
Select sieht übersichtlicher aus, als lauter If/ElseIf