GUI>... god
Author |
Message |
masterfenix
|
Posted: Thu Dec 01, 2005 7:41 pm Post subject: GUI>... god |
|
|
Ok,
well I have a procedure. The GUI Menu gets disabled, because the widget is true. I want it to be disabled. Because theres a file opened already to write too, and if someone switches to another proc using the menu, it errors out.
SO.
Basically, when they go to add a customer, it asks to input name, code, blah blah.
BUT What if someone wants to quit ? halfway through the procedure?
if I
code: | var quitBtn : int := GUI.CreateButton (50, 50, 0, "Quit", "return")
loop
exit when GUI.ProcessEvent
end loop
|
if i put that on top of the procedure, then since its a never ending loop, the rest isnt displayed.
any thought about how to do this?
(display the quit button, and run through the procedure.)
and if they press the proceudre, it uses "return" or soemthing to exit the proc and go back to main? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Fri Dec 02, 2005 9:01 am Post subject: (No subject) |
|
|
Have you thought about hiding the GUI widgets? |
|
|
|
|
|
masterfenix
|
Posted: Fri Dec 02, 2005 11:46 am Post subject: (No subject) |
|
|
well what do you mean?
i dont want it to HIDE. I want it to show, and WORK while executing the proc also. |
|
|
|
|
|
Lapsus Antepedis
|
Posted: Fri Dec 02, 2005 12:15 pm Post subject: (No subject) |
|
|
Well, in theory you could have a process that will watch for the button to be pressed, and when it is pressed you could use return to kill the program... If I'm understanding you...
PsudeoCode: |
% Variables
process quitter
if button is pressed then
return
end if
end quitter
fork quitter
loop
%Your Program Goes Here!
end loop
|
I don't know if it will work, seeing as I have no access to turing at the moment, but in theory, it's great... |
|
|
|
|
|
masterfenix
|
Posted: Fri Dec 02, 2005 12:35 pm Post subject: (No subject) |
|
|
well I tired a process.
but it wouldnt give me my results. like if someone pressed in , and went on to say "show customer list",
it would show the customer list, + the procedure for the add customer would run also. |
|
|
|
|
|
masterfenix
|
Posted: Sun Dec 04, 2005 1:37 pm Post subject: (No subject) |
|
|
anyone please help |
|
|
|
|
|
Cervantes
|
Posted: Sun Dec 04, 2005 1:47 pm Post subject: Re: GUI>... god |
|
|
Oftentimes, rephrasing your question can help. I know I'm lost:
masterfenix wrote: The GUI Menu gets disabled, because the widget is true. I want it to be disabled.
masterfenix wrote: i dont want it to HIDE. I want it to show, and WORK while executing the proc also.
You want it to be disabled, but you want it to work? Does this mean you want to be able to click on the menu and have it expand and such, but you want to disable selecting certain options from the menu? ie. I can open the file menu, but I cannot click save because I just saved my file and have not made any changes yet.
On the note of using processes, you should read the discussion on why to avoid processes |
|
|
|
|
|
masterfenix
|
Posted: Sun Dec 04, 2005 1:51 pm Post subject: (No subject) |
|
|
oh soryr.
yea the menu is disabled! I want it to be disabled. But a BUTTOn should pop up while in that procedure. Saying "quit" and when its pressed its "returns" the proc.
so that way there not stuck inside the procedure and have to wait till end of execution. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Sun Dec 04, 2005 1:56 pm Post subject: (No subject) |
|
|
You could try hiding the quit button to start, then showing the quit button when you open the file. |
|
|
|
|
|
masterfenix
|
Posted: Sun Dec 04, 2005 1:59 pm Post subject: (No subject) |
|
|
ok well heres my procedure.
its small.
code: | %% Add a new Customer.
proc putmessage
put "a message out"
end putmessage
proc addNewCustomer
cls
put "\n"
var quitBtn : int := GUI.CreateButton (1, 1, 0, "Quit", putmessage)
GUI.Show (quitBtn)
var CusRec : Customers
var userinput : string (2)
var quitproc : string
seek : fileRec, 0
seek : fileRec, *
put "Menu has been deactivated to prevent file corruption."
put "If you don't want to add a customer type 'y' now"
put "Bug #: JF-ANC01"
get quitproc
if quitproc = 'y' or quitproc = 'Y' then
showMenu ()
return
end if
put ""
put "Remember if you make a mistake, you can always edit it in the next step."
loop
put "Enter Customer Code (3 letters): " ..
get CusRec.CusCode
if checkForCode (fileRec, CusRec.CusCode) = false then
put "Enter Customer Name: " ..
get CusRec.CusName
put "Enter Email address: " ..
get CusRec.CusEmail
put "Enter Customer Type: (design, hosting): " ..
get CusRec.CusType
put "Has the Customer Paid? (Y/N) " ..
get userinput
if userinput = 'y' or userinput = 'Y' then
CusRec.CusStatus := 'y'
put "Enter the Customers finsihed product download Link, PUT 'NA' if not applicable. DONT LEAVE BLANK) :"
get CusRec.CusFinishProduct
loop
if CusRec.CusFinishProduct not= "" then
exit
else
put "Please try again"
get CusRec.CusFinishProduct
end if
end loop
else
CusRec.CusStatus := 'n'
CusRec.CusFinishProduct := 'Not paid yet'
end if
put "Enter the amount charged to the customer; " ..
get CusRec.CusPayment
put "Enter the Payment method (paypal, stormpay, moneyorder(MO), etc): " ..
get CusRec.CusPaymenttype
put "Add another costomer? (Y/N) -No will take you back to menu :" ..
get userinput
write : fileRec, CusRec
if userinput = 'n' or userinput = 'N' then
exit
end if
end if
end loop
put "Customer Added. Customer ID:", CusRec.CusCode
showMenu ()
end addNewCustomer
|
and heres my main file.
code: | var first, second, third, last : int % For the actual Menu
var item : array 1 .. 5 of int % The menu items.
% The name of the menu items
var name : array 1 .. 6 of string (20) := init ("Add Customer", "Show Customers", "Find Customer", "Edit Customer", "????", "QUIT")
first := GUI.CreateMenu ("Customers")
item (1) := GUI.CreateMenuItem (name (1), addNewCustomer)
item (2) := GUI.CreateMenuItem (name (2), displayCustomerList)
item (3) := GUI.CreateMenuItem (name (3), displayReportCode)
item (4) := GUI.CreateMenuItem (name (4), editCustomer)
item (5) := GUI.CreateMenuItem (name (5), displayCustomerList)
second := GUI.CreateMenu ("Work")
third := GUI.CreateMenu ("Financial Reports")
last := GUI.CreateMenu ("Help")
item (1) := GUI.CreateMenuItem ("Help", helpmenu)
showMenu
loop
exit when GUI.ProcessEvent % This is needed inside the main loop
end loop |
note: showMenu () is a procedure with these contents:
code: | proc showMenu
GUI.ShowMenuBar
end showMenu |
I am showing the button but it dosnt work. |
|
|
|
|
|
|
|