Hi,
I create two screens with each a panel and a button.
Then the screen shall switch if the button is clicked.
(no, I can't use setlink()).
After clicking the button the screen is switched but
there are no more events created.
If I switch the screen with space key it works fine.
The error must be somewhere in the lines marked with ***
Help appreciated..
I create two screens with each a panel and a button.
Then the screen shall switch if the button is clicked.
(no, I can't use setlink()).
After clicking the button the screen is switched but
there are no more events created.
If I switch the screen with space key it works fine.
The error must be somewhere in the lines marked with ***
Help appreciated..
SuperStrict Import fry.frygui Graphics 800, 600 ' Init frygui fry_LoadSkin("Skin") fry_SetResolution(800, 600, True) 'Create two screens with each one panel and one button: Local gs:TGuiScreen = New TGuiScreen gs.Init("Screen1") gs.Addpanel("Panel1", 0, 0, 800, 600) Local b:fry_TButton = fry_CreateButton("Start Button", "Start Game", 10, 10, 150, 50, gs.GetPanelbyName("Panel1")) Local gs2:TGuiScreen = New TGuiScreen gs2.Init("Screen2") gs2.Addpanel("Panel2", 0, 0, 800, 600) Local b2:fry_TButton = fry_CreateButton("Button", "Test", 10, 100, 150, 50, gs.GetPanelbyName("Panel2")) ' set screen 1 as active screen fry_SetScreen("Screen1") While Not KeyHit(KEY_ESCAPE) Cls If KeyHit(KEY_SPACE) fry_SetScreen("Screen2") ' This works fine, screen is switchen and events are polled! End If fry_Refresh() While fry_PollEvent() '******************* Local Text:String = fry_EventText() '******************* DebugLog (Text) '******************* If fry_EventID() = fry_EVENT_GADGETACTION '******************* fry_SetScreen("Screen2") 'This works not, screen is switched but after that no more events are polled! End If '******************* Wend '******************* Delay 1 Flip 1 DebugLog ("loop") WEnd Type TGuiScreen ' a frygui screen with different panels and buttons Global list:TList = New TList Field link:TLink ' Field name:String Field screen:fry_TScreen Field panellist:TList = New TList Field buttonlist:TList = New TList Method Init(screenname:String, family:String = "") ' Self.screen = New fry_TScreen Self.screen = fry_CreateScreen(screenname:String, family:String) fry_SetScreen(screenname) End Method Method Addpanel(panelname:String, x:Int, y:Int, w:Int, h:Int) Local panel:fry_TPanel = fry_CreatePanel(panelname, x, y, w, h) If panel = Null Throw("no panel") panel.HexColour("505080") Self.screen.AddPanel(panel) Self.panellist.AddLast(panel) End Method Method AddButton:fry_TButton(name:String, text:String, x:Int, y:Int, xsize:Int, ysize:Int, panel:fry_TPanel = Null) Local button:fry_TButton = fry_CreateButton(name, Text, x, y, xsize, ysize, panel) 'button.Create(name, Text, x, y, xsize, ysize, panel) Self.buttonlist.AddLast(button) return button End Method Method AddTextField(name:String, text:String, panelname:String) Local pan:fry_TPanel = GetPanelbyName(panelname) If pan = Null Throw ("no panel") Local tf:fry_TTextField = fry_CreateTextField(name, Text, 0, 100, 70, 20, 0, pan) ' tf.Create(name, Text, 10, 10, 20, 50, 0, Self.GetPanelbyName(panelname)) End Method Method GetPanelbyName:fry_TPanel(name:String) Local panel:fry_TPanel = fry_GetPanel(name) If panel = Null Throw ("no such panel") Return panel End Method Method Remove() Self.panellist = Null Self.buttonlist = Null Self.screen = Null End Method End Type