Hi
I’m trying to create an application with multiple buttons which should
be enabled/disabled depending on the existance of individual files on the web server.
The files will be created/deleted on the server during runtime.
Furthermore I would like to make it possible for all clients to see if a button has been pressed.
I know I could do something like this in the action event of the buttons:
For i As Integer = 0 To App.SessionCount-1
App.SessionAtIndex(i).CurrentPage.ControlWithName(me.Name).Style = stylePressed
Next
But I think that would only enable clients already logged in to see if the button was pressed.
Can anybody please point me in the right direction?
This is the code from the action event of a timer i’ve put in the project and it works:
for j As Integer = 0 to app.MyControls.Ubound
Dim ControlName As String = app.MyControls(j)
Dim f as FolderItem =GetFolderItem("").Parent.Child("templates").child(ControlName +".swf")
If f.exists then
For i As Integer = 0 To App.SessionCount-1
App.SessionAtIndex(i).PageWithName("PlayOutPage", True).ControlWithName(ControlName).Style = StyleReady
Next
else
For n As Integer = 0 To App.SessionCount-1
App.SessionAtIndex(n).PageWithName("PlayOutPage", True).ControlWithName(ControlName).Style = StyleNotReady
Next
end if
next
The timer has a period of 5000 - is this good practice - or?
“MyControls” is an array with names of the control I want to update.
Now I have to figure out how to broadcast that a button has been pressed - any ideas?
Seems like you are already doing a broadcast (by changing the style). To call a specify method on a page, you’ll want to cast the page returned using PageWithName to a type you can use.
For an example example, check out Web/PushExample that is included with the Xojo examples.