Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Buttons over buttons, or no buttons at all.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bakathy




PostPosted: Thu Jan 13, 2011 7:33 pm   Post subject: Buttons over buttons, or no buttons at all.

What is it you are trying to achieve?
I have a project where I have to make a screen saver program with passwords, settings, etc.
I'm trying to fix my code so that no buttons cover each other no matter how many times the user chooses to go back and forth between output screens.


What is the problem you are having?
Either the buttons are still on top of each other, or the buttons have no value at all.


Describe what you have tried to solve this problem
I've tried both GUI.Hide or GUI.Disable in various places in my program.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


import GUI
View.Set ("offscreenonly")
setscreen ("nocursor")

var mainWin : int := Window.Open ("position:center;center,graphics:500;650,title:Screen Saver Settings")
var menuButton, quitButton, screenSaverButton, settingsButton, soundButton, passwordButton, showWalkingPerson, showCookie, showBinary, showMusicBars, showFaces, fiveMinutes, tenMinutes,
    twentyMinutes, playButton, playGee, playJustBeFriends, playWeddingDress, playTieMeDown, playMoonlightJourney, noPassword, setPassword, waitingTime :
    int
var subtitleFont : int := Font.New ("raavi:16")
var titleFont : int

procedure title
    titleFont := Font.New ("raavi:18")
    Font.Draw ("Screen Saver Settings", 130, 630, titleFont, 7)
end title

procedure userInput
    Window.Show (mainWin)
    GUI.Hide (screenSaverButton)
    GUI.Hide (settingsButton)
    GUI.Hide (soundButton)
    GUI.Hide (passwordButton)
% the last place I've treid to place the cmds
    GUI.Hide (showWalkingPerson)
    GUI.Hide (showCookie)
    GUI.Hide (showBinary)
    GUI.Hide (showMusicBars)
    GUI.Hide (showFaces)
    cls
    title
    if GUI.GetEventWidgetID = screenSaverButton then % screen savers
        Font.Draw ("Screen Savers", 175, 610, subtitleFont, 7)
        showWalkingPerson := GUI.CreateButton (140, 550, 200, "1. Walking Person", title)
        showCookie := GUI.CreateButton (140, 500, 200, "2. Cookie", title)
        showBinary := GUI.CreateButton (140, 450, 200, "3. Binary", title)
        showMusicBars := GUI.CreateButton (140, 400, 200, "4. Music Bars", title)
        showFaces := GUI.CreateButton (140, 350, 200, "5. Faces", title)
        GUI.Show (menuButton)
        GUI.Show (quitButton)
    elsif GUI.GetEventWidgetID = settingsButton then % time to wait before the screen saver appears by itself
        Font.Draw ("Wait:", 215, 610, subtitleFont, 7)
        fiveMinutes := GUI.CreateButton (40, 550, 100, "5 minutes", title)
        tenMinutes := GUI.CreateButton (40, 500, 100, "10 minutes", title)
        twentyMinutes := GUI.CreateButton (40, 450, 100, "15 minutes", title)
        GUI.Show (menuButton)
        GUI.Show (quitButton)
    elsif GUI.GetEventWidgetID = soundButton then % music
        Font.Draw ("Sound", 210, 610, subtitleFont, 7)
        playGee := GUI.CreateButton (240, 400, 250, "SNSD - GEE (Instrumental)", title)
        playJustBeFriends := GUI.CreateButton (190, 350, 300, "Luca - Just be Friends (Intrumental)", title)
        playWeddingDress := GUI.CreateButton (140, 300, 350, "Taeyang - Wedding Dress (Instrumental)", title)
        playTieMeDown := GUI.CreateButton (40, 200, 450, "Lil Crazed feat. Skip & Maibelle Anes - Tie Me Down (Instrumental)", title)
        playMoonlightJourney := GUI.CreateButton (90, 250, 400, "My Neighbour Totoro - Moonlight Journey", title)
        GUI.Show (menuButton)
        GUI.Show (quitButton)
    elsif GUI.GetEventWidgetID = passwordButton then % password settings
        Font.Draw ("Password Settings", 160, 610, subtitleFont, 7)
        noPassword := GUI.CreateButton (40, 500, 100, "No Password", title)
        setPassword := GUI.CreateButton (350, 500, 100, "Set Password", title)
        GUI.Show (menuButton)
        GUI.Show (quitButton)
    else
        GUI.Quit
    end if
end userInput

procedure mainMenu
    Window.Show (mainWin)
    GUI.Hide (menuButton)
    cls
    title
    GUI.Show (quitButton)
    Font.Draw ("Main Menu", 190, 610, subtitleFont, 7)
    screenSaverButton := GUI.CreateButton (140, 550, 200, "Change Screen Saver", userInput)
    settingsButton := GUI.CreateButton (160, 500, 200, "Change Screen Saver Settings", userInput)
    soundButton := GUI.CreateButton (180, 450, 200, "Sound Options", userInput)
    passwordButton := GUI.CreateButton (200, 400, 200, "Change Password", userInput)
end mainMenu

procedure introduction
    title
    var introFont : int := Font.New ("Courier New:9")
    menuButton := GUI.CreateButton (90, 50, 100, "Main Menu", mainMenu)
    quitButton := GUI.CreateButtonFull (290, 50, 100, "Exit", GUI.Quit, 0, KEY_ESC, false)
    GUI.Show (menuButton)
    GUI.Show (quitButton)
    Font.Draw ("This program will", 10, 480, introFont, 7)
    Font.Draw ("display a screen saver", 320, 480, introFont, 7)
    Font.Draw ("of your choice as", 10, 460, introFont, 7)
    Font.Draw ("well as other settings.", 320, 460, introFont, 7)
end introduction

procedure goodBye
    Window.Close (mainWin)
    Music.PlayFileStop
end goodBye

introduction
loop
    exit when GUI.ProcessEvent
end loop
goodBye



Please specify what version of Turing you are using
I use 4.1.1


Help would be nice. Please and thank you. (:
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: