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

Username:   Password: 
 RegisterRegister   
 Button hiding in complex windows
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Boarder16




PostPosted: Sat Jan 17, 2004 1:28 pm   Post subject: Button hiding in complex windows

It's me again..(i know ur all happy to hear me talk again) Laughing , anywayi am making a program with multiple windows taht open and close. I have a menu, when they click on any of the things in the menu, it opens a new window.. now i have teh buttons that are to appear in the windows declared tehn hidden at teh very beginning of teh code, then when the new window is opened, i call GUI.Show. It shows the buttons but they are inactive.... i don't know why...it worked before wheen i called the buttons right then instead of at the top, but then when i wanted to GUI.Hide them after a button was clicked i couldnt because they were not declared..so you see teh problem.. i don't know if it has something to do with the buttosn being drawn is a seperate window.. and i do have the GUI.ProcessEvent running so its not htat...any help would be apreciated.. Exclamation
Sponsor
Sponsor
Sponsor
sponsor
Boarder16




PostPosted: Sat Jan 17, 2004 2:29 pm   Post subject: (No subject)

someone help Shocked
rgothmog




PostPosted: Sat Jan 17, 2004 2:34 pm   Post subject: (No subject)

try forwarding the procedure

code:

forward procedure whatever


and then
code:

body procedure whatever
*code*
end whatever
Boarder16




PostPosted: Sat Jan 17, 2004 5:52 pm   Post subject: (No subject)

i already did that.. i know mroe advanced programming hten taht...lol it won't ven work with that.. thats y i am asking ppl 4 help..
rgothmog




PostPosted: Sat Jan 17, 2004 5:55 pm   Post subject: (No subject)

hey at least i gave an idea... would have sucked if u didn't use forward and i never said n e thing and it could have fixed the problem Very Happy
shorthair




PostPosted: Sat Jan 17, 2004 6:16 pm   Post subject: (No subject)

People are trying to help Boarder, they dont know what your doing in your program , at least we actually give sugestions , just a simple , " ahh i tried that already , any other way to do it ?" , would have done keep the flames andemotions on the down low , that how my threads get ruined i HATE it , Very Happy Very Happy but anywho , why dont you post the code so i can mess around with it , its hard to fix what you cant see ( well for me )
rgothmog




PostPosted: Sat Jan 17, 2004 6:24 pm   Post subject: (No subject)

couldn't have put it better myself shorthair
Boarder16




PostPosted: Sat Jan 17, 2004 7:44 pm   Post subject: (No subject)

how was i flamming??? i said i know more advacned programming then that... i don't see how anyone can see that as flamming, and i think anyone whos asking about hiding and showing buttosn has learned or been told about forwarding procedures...
Sponsor
Sponsor
Sponsor
sponsor
Boarder16




PostPosted: Sat Jan 17, 2004 7:48 pm   Post subject: (No subject)

anyway, sorry if imad anyone "mad", but heres the code
code:
import GUI
var w1, w2, w3, w4, w5, w6, w7, background_new, data_file, action : int
var text, text_temp, today, time_day : string
var file, options : int
var item : array 1 .. 12 of int
var name : array 1 .. 12 of string (20) := init ("Programs", "---", "Edit Text", "Open Text", "---", "Other", "Exit", "Background", "Text Color", "---", "--1--", "--2--")
%----------------------------------------------------------FONT ID'S--------------------------------------------------------
var FontID1 := Font.New ("Stylus BT:14:bold")
var FontID2 := Font.New ("Arial:10:bold")
var FontID3 := Font.New ("Comic Sans MS:18")
var FontID4 := Font.New ("Enviro:10")
var FontID5 := Font.New ("Comic Sans MS:10:bold") %Date Text
%--------------------------------------------------------PROCEDURE FORWARDS-------------------------------------------------
forward proc background_edit
forward proc background
forward proc exit_program
forward proc menu_load
forward proc program_list
forward proc text_edit
forward proc text_open
forward proc other
forward proc text_color
forward proc back_1
forward proc back_2
forward proc back_3
forward proc save_vars
forward proc close_w2
forward proc load_settings
forward proc close_w5
forward proc close_w4
forward proc status_bar
%-------------------------------------------------------TEXT EDIT BUTTONS---------------------------------------------------
var save_text : int := GUI.CreateButtonFull (10, 10, 0, "Save", save_vars, 0, '^S', true)
var exit_w4 : int := GUI.CreateButtonFull (150, 10, 0, "Exit", close_w4, 0, '^C', true)
GUI.Hide (save_text)
GUI.Hide (exit_w4)
%-------------------------------------------------------TEXT OPEN BUTTONS---------------------------------------------------
var exit_w5 : int := GUI.CreateButtonFull (10, 10, 0, "Exit", close_w5, 0, '^C', true)
GUI.Hide (exit_w5)
%---------------------------------------------------BACKGROUND CHANGE BUTTONS-----------------------------------------------
var new_back1 : int := GUI.CreateButtonFull (10, 250, 0, "Moon", back_1, 0, '^M', true)
var new_back2 : int := GUI.CreateButtonFull (10, 200, 0, "Desert", back_2, 0, '^D', true)
var new_back3 : int := GUI.CreateButtonFull (10, 150, 0, "Island", back_3, 0, '^I', true)
var exit_w2 : int := GUI.CreateButtonFull (10, 80, 0, "Exit", close_w2, 0, '^M', true)
GUI.Hide (new_back1)
GUI.Hide (new_back2)
GUI.Hide (new_back3)
GUI.Hide (exit_w2)
%-----------------------------------------------------SCREEN SETTINGS------------------------------------------------------
w1 := Window.Open ("title: Operating System  X-Raleion                                                                       M@ + Digital Images , graphics: 700, 600, position: 170,50")
setscreen ("nocursor")
process gui_run
    loop
        exit when GUI.ProcessEvent
    end loop
end gui_run
process gui_run1
    loop
        exit when GUI.ProcessEvent
    end loop
end gui_run1
%---------------------------------------------------OPEN VARIABLES----------------------------------------------------------
body proc load_settings
    open : data_file, "runsys", get
    get : data_file, background_new, text
    close : data_file
end load_settings
%---------------------------------------------------BACKGROUND LAOD---------------------------------------------------------
body proc background
    if background_new = 1 then
        Pic.ScreenLoad ("C:/My Documents/My Pictures/moon.jpg", 0, -22, picCopy) %Load Background
    elsif background_new = 2 then
        Pic.ScreenLoad ("C:/My Documents/My Pictures/desert.jpg", 0, -22, picCopy) %Load Background
    elsif background_new = 3 then
        Pic.ScreenLoad ("C:/My Documents/My Pictures/island.jpg", 0, -22, picCopy) %Load Background
    end if
end background
%--------------------------------------------------------MENU---------------------------------------------------------------
body proc menu_load
    file := GUI.CreateMenu ("File")
    item (1) := GUI.CreateMenuItem (name (1), program_list)
    item (3) := GUI.CreateMenuItem (name (3), text_edit)
    item (4) := GUI.CreateMenuItem (name (4), text_open)
    item (6) := GUI.CreateMenuItem (name (6), other)
    item (7) := GUI.CreateMenuItem (name (7), exit_program)

    options := GUI.CreateMenu ("Options")
    item (8) := GUI.CreateMenuItem (name (8), background_edit)
    item (9) := GUI.CreateMenuItem (name (9), text_color)
    item (11) := GUI.CreateMenuItem (name (11), other)
    item (12) := GUI.CreateMenuItem (name (12), other)
end menu_load
%------------------------------------------------------PROGRAM LIST---------------------------------------------------------
body proc program_list
    w3 := Window.Open ("title: X-Raleion Program List   , graphics: 400, 400, position: 300,200")
    Pic.ScreenLoad ("Raleion.jpg", 0, 0, picCopy) %Load Background
    delay (2000)
    Window.Close (w3)
end program_list
%--------------------------------------------------------TEXT EDIT----------------------------------------------------------
body proc save_vars
    GUI.Hide (save_text)
    GUI.Hide (exit_w4)
    text := text_temp
    open : data_file, "runsys", put
    put : data_file, background_new, "  ", text
    close : data_file
    Window.Close (w4)
end save_vars

body proc close_w4
    GUI.Hide (save_text)
    GUI.Hide (exit_w4)
    Window.Close (w4)
end close_w4

body proc text_edit
    fork gui_run1
    w4 := Window.Open ("title: X-Raleion Edit Text   , graphics: 400, 400, position: 300,200")
    put "                   Enter Text"
    GUI.Show (save_text)
    GUI.Show (exit_w4)
    get text_temp
end text_edit
%--------------------------------------------------------TEXT OPEN----------------------------------------------------------
body proc close_w5
    GUI.Hide (exit_w5)
    Window.Close (w5)
end close_w5

body proc text_open
    w5 := Window.Open ("title: X-Raleion Text Open   , graphics: 400, 400, position: 300,200")
    open : data_file, "runsys", get
    get : data_file, text
    close : data_file
    put text
    GUI.Show (exit_w5)
end text_open
%----------------------------------------------------------OTHER------------------------------------------------------------
body proc other
    w6 := Window.Open ("title: X-Raleion Excess Program Space   , graphics: 400, 400, position: 300,200")
    put "program list"
    delay (2000)
    Window.Close (w6)
end other
%-----------------------------------------------------TEXT COLOR PROGRAM----------------------------------------------------
body proc text_color
    w7 := Window.Open ("title: X-Raleion Text Color Edit   , graphics: 400, 400, position: 300,200")
    put "text color"
    delay (2000)
    Window.Close (w7)
end text_color
%-----------------------------------------------------BACKGROUND CHANGE-----------------------------------------------------
body proc back_1
    GUI.Hide (new_back1)
    GUI.Hide (new_back2)
    GUI.Hide (new_back3)
    GUI.Hide (exit_w2)
    background_new := 1
    Window.Close (w2)
    Pic.ScreenLoad ("C:/My Documents/My Pictures/moon.jpg", 0, -22, picCopy)     %Load Background
    View.Update
    status_bar
end back_1

body proc back_2
    GUI.Hide (new_back1)
    GUI.Hide (new_back2)
    GUI.Hide (new_back3)
    GUI.Hide (exit_w2)
    background_new := 2
    Window.Close (w2)
    Pic.ScreenLoad ("C:/My Documents/My Pictures/desert.jpg", 0, -22, picCopy)     %Load Background
    View.Update
    status_bar
end back_2

body proc back_3
    GUI.Hide (new_back1)
    GUI.Hide (new_back2)
    GUI.Hide (new_back3)
    GUI.Hide (exit_w2)
    background_new := 3
    Window.Close (w2)
    Pic.ScreenLoad ("C:/My Documents/My Pictures/island.jpg", 0, -22, picCopy)     %Load Background
    View.Update
    status_bar
end back_3

body proc close_w2
    GUI.Hide (new_back1)
    GUI.Hide (new_back2)
    GUI.Hide (new_back3)
    GUI.Hide (exit_w2)
    Window.Close (w2)
end close_w2

body proc background_edit
    w2 := Window.Open ("title: X-Raleion Background Change   , graphics: 400, 400, position: 370,250")
    Font.Draw ("Select a new background", 80, 380, FontID1, black)
    GUI.Show (new_back1)
    GUI.Show (new_back2)
    GUI.Show (new_back3)
    GUI.Show (exit_w2)
end background_edit
%----------------------------------------------------------STATUS BAR--------------------------------------------------------
process time_date
    loop
        date (today)
        time (time_day)
        drawfillbox (550, 5, 698, 19, white)
        Font.Draw ("" + time_day + "  " + today, 550, 5, FontID5, black)
        delay (1000)
    end loop
end time_date

body proc status_bar
    drawfillbox (0, 0, 700, 21, black)
    drawfillbox (0, 1, 700, 20, white)
    drawfillbox (0, 22, 700, 23, white)
    drawfillbox (541, 1, 541, 20, black)
    drawfillbox (699,1, 700, 20, black)
    drawfillbox (0, 1, 0, 20, black)
    fork time_date
end status_bar
%---------------------------------------------------------EXIT PROGRAM------------------------------------------------------
body proc exit_program
    open : data_file, "runsys", put
    put : data_file, background_new, "  ", text
    close : data_file
    Window.Close (w1)
end exit_program

%--------------------------------------------------------Procedure Calls and Running----------------------------------------
fork gui_run
load_settings
background
menu_load
status_bar



now be warned.. u need to create a file first called "runsys"..or u can delete the actual loading section so it dosen't search for the file before it is screted...becasue it runs off of variables in it...
AsianSensation




PostPosted: Sat Jan 17, 2004 7:59 pm   Post subject: (No subject)

I personally don't like Turing's GUI, so I don't use it. But when I do use it, and it gives me a mess, like opening multiple windows and have separate GUI in each window, I always like to declare the GUI buttons, menus, sliders, etc, and whenever I don't use it, I GUI.Dispose it. And when I want to use it again, I declare it again. It might take some more lines, but it usually doesn't mess with your program if you kill the thing as soon as you are done finishing using it. This is true especially if you have stuff happening all over.
Boarder16




PostPosted: Sat Jan 17, 2004 8:03 pm   Post subject: (No subject)

but i can't gui.dispose unless i declare it at the top... and i do it does not run becaucse a problem i cannot see, if i declare the buttons as i got and need them it works. until they appear whn i du nwant them to, and i GUi.Dispose/GUI.Hide but it says the buttons has not been declared, and i have to have the procedures where GUI.Hide is called above the actual button call...actually.. if they are all forwarded i shouldn't have to.. should i....hmmmm
Boarder16




PostPosted: Sat Jan 17, 2004 11:20 pm   Post subject: (No subject)

does anyone got any ideas or see the problem? i need sum help Evil or Very Mad
shorthair




PostPosted: Sun Jan 18, 2004 10:42 am   Post subject: (No subject)

Looking at hte code boarder , im not seeing a visable problem righ now , but im gonna keep playing with it
Boarder16




PostPosted: Sun Jan 18, 2004 12:25 pm   Post subject: (No subject)

k, thanks Smile
Boarder16




PostPosted: Sun Jan 18, 2004 3:39 pm   Post subject: (No subject)

hey al lyou smart admins!! can you help??
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  [ 15 Posts ]
Jump to:   


Style:  
Search: