Reporting bug with SetWallPaper RRS feed

  • General discussion

  • Hi.

    I would like to report what seems to me to be a bug.

    Lets' consider the following program :
        Img = Flickr.GetRandomPicture("mountain")

    The wallpaper is correctly changed but since there was no TextWindow/GraphicsWindow in my program te only way to closed it is to click on the "End Program" button on the blue screen indicating that "Your program (...) has started and is running".
    I think I would be better that when a program is finished  and there isn't ( or isn't anymore) any TextWindow/GraphicsWindow to automatically end it.
    Even worse : if you launch this program with the .exe then there is no way to end it, you have to kill it with the "Task manager"...

    The same rule can apply to this program :

    Of course, there is no reason to do some thing like that and one should use the "Program.End()" function in a such case (if we want for any reason to hide the window at the end of the program...) but if this window is hidden and there is no TextWindow and the program is finished ( or waiting for event : since the window is hidden there can be no event ) and I think it should end automatically.

    Anyway let's get back to the first program and modify it a little :
      Img = Flickr.GetRandomPicture("mountain")
      TextWindow.WriteLine("Some text")

    The TextWindow is correctly showing the text and the message "Press any key to continue" afterwards but nothing happened when you press a key ! To close the program you have to click on the "End Program" button or, of course, on the cross at the top-right corner of the TextWindow.
    It's seem that the function "SetWallPaper" is creating some problems here.

    These problems occurs on both my "XP SP3" and "Vista" computers.

    Can anyone confirm this bug ?


    Friday, January 23, 2009 4:50 PM

All replies

  • I can't say it is a "bug" but it does happen to me too.

    I think you have the answer through - use "Program.End()"
    If you do that, does your wall paper program end?

    • Edited by Path_drc Friday, January 23, 2009 8:25 PM correction
    Friday, January 23, 2009 7:56 PM
  • It won't let me edit my post.

    The command should be "Program.End()"

    Friday, January 23, 2009 8:26 PM
  • Yes, it's working fine with "Program.End()", I was already doing that to fixed it.
    My point is that I'm trying to teach SmallBasic to my 10 years brother and a simple program that was doing something powerful and visible was this
      Img = Flickr.GetRandomPicture("mountain")

    But after he try it something like 15 times there was 15 processes in memory using each 20 Mb of memory....
    I add a "Program.End()" at the end to avoid that but for a beginner it's not very intuitive !
    I had to explain my brother that when you are using the TextWindow the computer know when the program is finished but when you are just setting the wallpaper you have to explicitly tell him....
    Of course you can set as a rule that every program should end with Program.End() but once again it's not really intuitive for a beginner, and we really don't want every program to have it....but otherwise I will have to explained when it is needed and when it is not.

    Do you see what I mean ?

    Friday, January 23, 2009 11:55 PM
  • Loïc Février,

    There's a reason why that program doesn't exit until you ask it to exit.  Originally the program was set to exit when it was "done."  Typically users were running Small Basic in maximized state where the desktop was hidden behind the maximized window.  And when the program ran and disappeared quickly, the kids (that were testing this) didn't really see any change and thought nothing really happened.  They ran the program over and over expecting something to happen.

    I agree the solution that I came up with was a pretty lame one, but it made the kids stop and think what the program was supposed to do and check the desktop to wait for it to change - and then realize that the wall paper has already changed.

    That said, I'll be interested in listening to other ways of solving this problem. 


    Saturday, January 24, 2009 5:43 AM
  • Vijaye Raji,

    I understand the reason for a such behaviour and in interactive mode it's working but if you manually run the .exe then you have absolutely no way to end the program without the "Task manager".
    It's seems that for now SetWallPaper is the only function with a such behaviour ? Is it right ?
    But why the "Press any key to continue" is not working ? (i.e. you need to close the TextWindow, pressing a key won't work)

    By the way, the message "Press any key to continue" appears too early some times :

        TextWindow.WriteLine("First text")
        GraphicsWindow.MouseDown = Test
        Sub Test
    Will produced
        First text
        Press any key to continue
    if you clicked twice on the GraphicsWindow.

    Here is the conditions to end the program (and to show the message "Press any key to continue") that I would proposed :
    - At anytime if the text/graphic window is closed then end of the program.
    - If we are at the end of the program, i.e. no instruction to read, no TextWindow.Read(), just possibly some events we are waiting for.
    At that moment there is 4 different cases depending of the presence or not of the two windows :
    * if the graphic window is shown do nothing, just wait for the user to close it ; it might get hidden later (by an event) and at that moment we will fall in one of the others cases
    * if the text window is here (no event can occur so nothing will ever happened now), display "Press any key to continue" and wait for the user to press a key or to close the window ; This will solve the problem with
        Img = Flickr.GetRandomPicture("mountain")
        TextWindow.WriteLine("Some text")
    * if there is no window here (the first problem I was exposing) then display "Press any key to continue" in the TextWindow ; This window should not normaly appears but it has two advantages : the user know something is happening and if he don't want the window to appear then he can use the Program.End()
    * The message "Press any key to continue" should not appears otherwise (solving the problem I was exposing above).

    Sunday, January 25, 2009 12:38 PM
  • Good points, Loïc.  I absolutely agree with your suggestions and I will try to fix them either for the next release or the one after that.


    Monday, January 26, 2009 12:58 AM