Forum Discussion

dynamitemedia's avatar
dynamitemedia
Binge Watcher
15 years ago

screen wont close

Here is my code for a keyboard screen for the search....

if msg.isButtonPressed() then
if msg.GetIndex() = 1

search = screen.GetText()
RegWrite("search", search)

SearchResultsMain()
exit while

end if ' if 1
if msg.GetIndex() = 2

exit while
end if ' 2
end if
end if
end while

screen.Close()


its strange cause it keeps flashing when i click up and out of the search. and in fact it is not closing at all behind itself. even when i go to a different category and leave it, will flash the keyboard again.

if you hit the #2 which is a button saying "Go Back" no problems it doesnt flash

9 Replies

  • It looks like you displaying the search results before you close the keyboard screen/exit your while, which would cause the flickering you're seeing. Try moving (or adding) screen.Close() to just before your call to SearchResultsMain().
  • tried that endless now its acting even stranger... in fact have tried that before but its just jumping around

    when i hit the search button it flashes back to the homeScreen and the "search" icon then to the search results page

    and if i got to say the MMA shows and exit out it also flashes to the "search" icon on the Homescreen
  • jbrave's avatar
    jbrave
    Channel Surfer
    Try putting your search screen into a function that returns the results. When the sub or function ends, the screen should close as it only exists in that context if you do your createobject("rosearchscreen") in the sub. Don't use an m. variable for creating a screen object that you use in a sub or function or it won't close correctly, since it still exists.

    - Joel
  • Joel, i have to say i have no idea what you mean...

    its the keyboard screen thats giving me the issues, the search is a function and is closing.

    EDIT: i am using keyboard not the roSearch
  • jbrave's avatar
    jbrave
    Channel Surfer
    I mean, you have screen, be it an rosearchscreen or an rokeyboard screen, shouldn't matter what

    Put all your code that deals with the screen inside a function: (might be some mistakes, i'm trying to communicate a general idea here):

    function keyscreen() as string
    screen=CreateObject("rokeyboardscreen")
    port=createobject("romessageport")
    screen.SetMessagePort("port")
    while true
    msg=wait(0,port)
    if msg.isButtonPressed() then
    if msg.GetIndex() = 1

    search = screen.GetText()
    RegWrite("search", search)
    SearchResultsMain()
    exit while
    end if ' if 1

    if msg.GetIndex() = 2
    exit while
    end if ' 2
    end if
    end while
    return search
    end function
  • you know what Joel, my keyboard screen is just like that now. what seems to be the issue right now isnt even on the search i think but the HomeScreen.

    seems what it is doing with any of the categories i pushed into the home screen, is that they just "flash" to the icon of the last category selected or msg.is ListItemSelected() . then they go back to the first category i pushed into the home screen

    this is only happening when using up to exit any categories i forced in with a push. so it also could be in the "sub main() "

    I will play around with it when i get done with dinner, there must be a way maybe even using your "Refresh" idea 😉 to stop that.

    its really not a huge deal now, better than that keyboard popping up! thanks endless putting that screenclose seemed to stop that. i had the screen close at the bottom like the normal keyboard example, but of course this channel isn't a normal channel!
  • It honestly sounds like you've got multiple poster screens with the same content on them, hence the bizarre flashing of content. Is it possible you're recreating the screen in some cases instead of closing the screen on top?
  • Did you try modifying the example code for the roSearchScreen in the Component Reference Guide?

    That should be a good working example to start with and modify.

    --Kevin