360tv
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012
08:57 PM
ShowMessageDialog
so if I plop this code from the component reference into my appHomeScreen.brs...
it freezes after it shows up. Button 1 doesn't do anything and I have to exit out of the app entirely. What's going on with that?
My goal is to create sort of a "Message Of The Day" kinda thing. But my first step is to get a simple dialog box to work. Then I'll address how to feed it the information I want (probably thru a separate xml feed).
Function ShowMessageDialog() As Void
port = CreateObject("roMessagePort")
dialog = CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("[Message dialog title]")
dialog.SetText("[Message dialog text............]")
dialog.AddButton(1, "[button text]")
dialog.Show()
while true
dlgMsg = wait(0, dialog.GetMessagePort())
if type(dlgMsg) = "roMessageDialogEvent"
if msg.isScreenClosed()
exit while
end if
end if
end while
End Function
it freezes after it shows up. Button 1 doesn't do anything and I have to exit out of the app entirely. What's going on with that?
My goal is to create sort of a "Message Of The Day" kinda thing. But my first step is to get a simple dialog box to work. Then I'll address how to feed it the information I want (probably thru a separate xml feed).
3 REPLIES 3

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012
09:19 PM
Re: ShowMessageDialog
There's no handler in there for the button selection. Modify it to handle the button selection.
Function ShowMessageDialog() As Void
port = CreateObject("roMessagePort")
dialog = CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("[Message dialog title]")
dialog.SetText("[Message dialog text............]")
dialog.AddButton(1, "[button text]")
dialog.Show()
while true
dlgMsg = wait(0, dialog.GetMessagePort())
if type(dlgMsg) = "roMessageDialogEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isButtonPressed() then
' This assumes you only have one button and you want it
' to close the dialog when selected, otherwise check
' msg.GetIndex() and respond appropriately
dialog.Close()
end if
end if
end while
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
360tv
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2012
08:42 PM
Re: ShowMessageDialog
How?
As I'm reading the code, what you've typed in should make the dialog box close when you click the button (right?). But it dosen't.
As I'm reading the code, what you've typed in should make the dialog box close when you click the button (right?). But it dosen't.

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2012
10:07 PM
Re: ShowMessageDialog
Oops. I just copied and modified the code you posted earlier. The problem is that that code assigns the variable "dlgMsg" but checks "msg". Try this instead.
Function ShowMessageDialog() As Void
port = CreateObject("roMessagePort")
dialog = CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("[Message dialog title]")
dialog.SetText("[Message dialog text............]")
dialog.AddButton(1, "[button text]")
dialog.Show()
while true
msg = wait(0, dialog.GetMessagePort())
if type(msg) = "roMessageDialogEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isButtonPressed() then
' This assumes you only have one button and you want it
' to close the dialog when selected, otherwise check
' msg.GetIndex() and respond appropriately
dialog.Close()
end if
end if
end while
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)