Pages buttons proplem and add to cart button
Author |
Message |
xsystem24
|
Posted: Thu Dec 12, 2013 10:13 pm Post subject: Pages buttons proplem and add to cart button |
|
|
Hi guys, i'm student in high school and there's final project to do so i need some help. The project i'm working on is a store (something like store).
It should contain welcome page, 4 items (each item has 'see' button), item page, checkout page, exit page
What is the problem you are having?
I want to make buttons for the pages and 'Add to cart' button in the item page which the user click on it, it adds the price to the checkout page without going to it.
First one:
There will be a pagination in the bottom of all pages [1, 2, 3]
1 > Welcome page
2 > Items
3 > Checkout
And when the user is viewing welcome page, he can click on 2 and go to items page while the pagination is on and then he can see each item and go back to the items page but i did a simple test and the pagination disappear when i click on 2.
Second one:
When the user click on button "Check out" in check out page, he goes to the last page which is the exit or thank you page.
What is it you are trying to achieve?
1. I want the pagination to be there forever and never gone, when i click on 1 it goes again to page 1 while the pagination is appeared and i can go to items page and still the pagination appeared.
2. To make button inside a procedure.
3. When he click on a checkout button, he goes to thank you page.
4. Add to cart button which has function (It adds the price to checkout page with going to it)
Describe what you have tried to solve this problem
I tried to test the idea first, and here is the code that i wrote but the problem now when i click on 2, it goes to 2 but the pagination is disappeared.
Turing: |
import GUI
drawfill (100, 100, blue, cyan) % Background
procedure firstpage
drawfill (100, 100, cyan, cyan)
end firstpage
procedure secondpage
drawfill (100, 100, green, green)
end secondpage
procedure thirdpage
drawfill (100, 100, black, cyan)
end thirdpage
var button1 : int := GUI.CreateButton (25, 6, 0, "1", firstpage )
var button2 : int := GUI.CreateButton (65, 6, 0, "2", secondpage )
var button3 : int := GUI.CreateButton (105, 6, 0, "3", thirdpage )
GUI.SetColor (button1, white)
GUI.SetColor (button2, white)
GUI.SetColor (button3, white)
loop
exit when GUI.ProcessEvent
end loop
|
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Thu Dec 12, 2013 10:32 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
Im not familiar with the Turing GUI stuff, and personally hate it, so I can't help you out here.
If you want, I made button module that makes more sense for Turing, if you want to try it(and I'd help you set it up): http://compsci.ca/v3/viewtopic.php?t=30797
Anyways, good luck |
|
|
|
|
|
Tony
|
Posted: Thu Dec 12, 2013 10:35 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
I suspect that drawfill is doing something other than what you think it's doing. Check out the documentation at drawfill and think about why it takes two colours as arguments.
Since you are just testing out a concept, I suggest using something like Draw.FillOval instead.
code: |
procedure secondpage
Draw.FillOval(100, 100, 10, 10, green)
end secondpage
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
xsystem24
|
Posted: Thu Dec 12, 2013 10:40 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
Thanks Raknarg =D Your article is very good.
Thanks tony actually it's working, it helped me to get a idea for the project.
But do you guys know when the user click on checkout so he will be sent to thanks page
How can i do it ?!
And a button inside a procedure. |
|
|
|
|
|
Tony
|
Posted: Thu Dec 12, 2013 11:09 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
In what way is "thank you page" different from "first page", that you can't implement them the same way?
You should be able to create a new GUI button from inside the procedure, the same way as you are doing it now outside of one. I think GUI elements are global in scope, so the button will continue to exist after the procedure is done.
In might be helpful to not think of this in terms of "pages", as one might think of websites. There is no "page" to navigate to, or back from. You have a single application that runs via
code: |
loop
exit when GUI.ProcessEvent
end loop
|
This loop drives GUI events, that in turn could run even more code, but ultimately your program is always in the same scope and in a persistent state. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
evildaddy911
|
Posted: Fri Dec 13, 2013 3:56 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
if im reading your post correctly, the buttons are disappearing when you draw the box over the screen right? in that case, immediately after drawing the box, call GUI.Refresh to redraw the buttons |
|
|
|
|
|
xsystem24
|
Posted: Fri Dec 13, 2013 5:28 pm Post subject: RE:Pages buttons proplem and add to cart button |
|
|
thanks man, "GUI.Refresh" has solved my problem. =D |
|
|
|
|
|
|
|