Using GUI button help
Author |
Message |
Scoliosis
|
Posted: Thu Jan 12, 2006 5:42 pm Post subject: Using GUI button help |
|
|
k i need help i made a program that lets a user enter in his or her first name and last name, Then when i click save it makes a directory using the users last name then first name (EX smith, john) and then makes a .DAT file in the directory all by clicking the save button. How can i do this. here is my code
import GUI
View.Set ("graphics:600;480,nobuttonbar")
var nameFTextField, nameLTextField : int
var font1, font2 : int
font1 := Font.New ("arial:18")
assert font1 > 0
font2 := Font.New ("arial:12:bold")
assert font2 > 0
procedure firstEntered (text : string)
GUI.SetSelection (nameLTextField, 0, 0)
GUI.SetActive (nameLTextField)
end firstEntered
procedure lastEntered (text : string)
GUI.SetSelection (nameFTextField, 0, 0)
GUI.SetActive (nameFTextField)
end lastEntered
%procedure dircreator (lastname, firstname : string)
procedure dircreator
GUI.Refresh
Dir.Create ("Hey")
% Dir.Create (lastname + ", " + firstname)
if Error.Last = eNoError then
put "Directory created"
else
put "Error: ", Error.LastMsg
end if
end dircreator
GUI.SetBackgroundColor (white)
var quitButton := GUI.CreateButton (325, 155, 100, "Cancel", GUI.Quit)
var saveButton := GUI.CreateButton (150, 155, 100, "Save Student", dircreator)
var firstlabel := GUI.CreateLabelFull (295, 270, "First Name", 0, 0,
GUI.RIGHT, font2)
var lastlabel := GUI.CreateLabelFull (295, 240, "Last Name", 0, 0,
GUI.RIGHT, font2)
var titleLabel := GUI.CreateLabelFull (420, 370, "Add a New Student", 0, 0,
GUI.RIGHT, font1)
nameFTextField := GUI.CreateTextFieldFull (300, 270, 100, "",
firstEntered, GUI.INDENT, 0, 0)
nameLTextField := GUI.CreateTextFieldFull (300, 240, 100, "",
lastEntered, GUI.INDENT, 0, 0)
loop
exit when GUI.ProcessEvent
end loop
GUI.Dispose (quitButton)
GUI.Dispose (saveButton)
colorback (white)
Text.Locate (maxrow - 1, 1)
put "First Name = ", GUI.GetText (nameFTextField)
put "Last Name = ", GUI.GetText (nameLTextField)
thanks in advanced |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
person
|
Posted: Thu Jan 12, 2006 5:55 pm Post subject: (No subject) |
|
|
learn file io |
|
|
|
|
 |
Scoliosis
|
Posted: Thu Jan 12, 2006 5:59 pm Post subject: (No subject) |
|
|
im asking because i dont know so maybe someone with HELPFUL information could respond |
|
|
|
|
 |
Cervantes

|
Posted: Thu Jan 12, 2006 6:07 pm Post subject: (No subject) |
|
|
No, he's right. Learn about file input/output. You'll find a link to the File I/O Tutorial in the Turing Walkthrough. |
|
|
|
|
 |
Scoliosis
|
Posted: Thu Jan 12, 2006 8:54 pm Post subject: (No subject) |
|
|
well i took a look at the tut and it didnt help much. I am wondering how to create a dir with simple parameters using GUI buttons and for some reason you guys keep refering me to tuts that dont even make mention to using GUI. so maybe someone could offer real help instead of another usless tut (not to say the tut IS in fact usless it just has no relevence, in a way to what im asking) |
|
|
|
|
 |
Delos

|
Posted: Thu Jan 12, 2006 11:41 pm Post subject: (No subject) |
|
|
Hmm...let's see:
Input
GUI
Files
Directories aren't that hard, just check the F10 info on them. Also, include your code in either [code] or [syntax] tags. And dude, don't stress so much...tuts are there because ~70% of questions asked are already answered. The other 30% are answered by the person who asked them. (Yes, all subjective statistics, but I don't have the time or resources to create relative frequencies...) |
|
|
|
|
 |
|
|