
-----------------------------------
Prince
Wed Apr 16, 2003 10:35 am

gui program...
-----------------------------------
k im workin on a gui form of permutations & combinations and its not workin wen i put values into the text boxes (only finds p & c for 1 and 1 :? )
if anyone can help it would b greatly appreciated

*note: problem solved

-----------------------------------
Dan
Wed Apr 16, 2003 4:57 pm


-----------------------------------
i whode help but my gui files are messed up form trying to modifley them  :oops: . hopfully some one eltes will be able to figer it out.

-----------------------------------
Prince
Wed Apr 16, 2003 9:49 pm


-----------------------------------
is anyone here good with gui's?

-----------------------------------
Leafs Fan
Thu Apr 17, 2003 2:47 pm


-----------------------------------
what school do u go to prince?

-----------------------------------
Prince
Thu Apr 17, 2003 4:43 pm


-----------------------------------
i go to milliken... y?

-----------------------------------
MysticAngel
Sat Apr 19, 2003 9:09 pm


-----------------------------------
Hey prince did u figure it out what the problem was

-----------------------------------
Blade
Sat Apr 19, 2003 9:11 pm


-----------------------------------
is anyone here good with gui's?
delta is awesome with gui's

-----------------------------------
Prince
Sun Apr 20, 2003 12:54 pm


-----------------------------------
no mystic i still havnt figured it out yet... delta if ur readin this can u plz help me out

-----------------------------------
MysticAngel
Tue Apr 22, 2003 9:59 am


-----------------------------------
prince.. i dont know but u know the first part of the code where u declare the variables.. n and r and then u gave it  a value. maybe there's the problem. cuz u said that both the values are 1. shodnt you put it to the values that are inputed ???

-----------------------------------
Prince
Tue Apr 22, 2003 10:05 am


-----------------------------------
im tryin but that doesnt seem to b workin either cus now there ar other variables (that need n and r) that dont hav any values

-----------------------------------
MysticAngel
Tue Apr 22, 2003 10:11 am


-----------------------------------
It seems that u have given all the variables the same value (in ur case 1)
so if u change the value of n and r where u declared it to say 2, then the answer too is 2. If see if can assign the value for n and r the value that is inputed through the text box.

-----------------------------------
Prince
Tue Apr 22, 2003 10:18 am


-----------------------------------
how tho... im tryin to figure it out but i cant

-----------------------------------
MysticAngel
Tue Apr 22, 2003 10:19 am


-----------------------------------
U dont have that thing called as GetPositiveInteger do u? u think that would  help?

-----------------------------------
Prince
Tue Apr 22, 2003 10:33 am


-----------------------------------
not in a gui... i dont think so anyway... mayb i should try that

-----------------------------------
jamez
Tue Apr 22, 2003 1:09 pm


-----------------------------------
hmm?

you can use the function abs which returns positive al lthe time

x:=abs(-100)
x is 100

x:=abs(100)
x is 100

-----------------------------------
Delta
Tue Apr 22, 2003 1:49 pm


-----------------------------------
Okay if you need some help, the best way to get my attention is to email or private message me. Your problem the code your having problems with and an explaination of your problems. My email is SSDelta_@hotmail.com so email and then I'll print it out and finish/fix it at home if I can, because I lack internet except at school.

Get back to me later if your still need help

-----------------------------------
Leafs Fan
Tue Apr 22, 2003 1:49 pm


-----------------------------------
i go to milliken... y?

so do i...:D

-----------------------------------
Prince
Tue Apr 22, 2003 5:09 pm


-----------------------------------
thnx delta, ill email u if i still hav problems... leafs fan, which class r u in?

-----------------------------------
Leafs Fan
Tue Apr 22, 2003 9:27 pm


-----------------------------------
Mr. Lutz's period five.... u?

-----------------------------------
Prince
Wed Apr 23, 2003 9:50 am


-----------------------------------
lutz per. 2

-----------------------------------
Leafs Fan
Wed Apr 23, 2003 4:56 pm


-----------------------------------
cool.. whats ur real name?

-----------------------------------
ZeroKelvin
Wed Apr 23, 2003 7:54 pm


-----------------------------------
hey leaf fan guess who i am, me also in lutz period 2
im also trying to figure out the damn gui perm and combo
i need help bad :? ...........help

-----------------------------------
Leafs Fan
Wed Apr 23, 2003 10:19 pm


-----------------------------------
Som1 named kelvin...lol.. post the code and maybe ill know whats wrong with it..

-----------------------------------
ZeroKelvin
Thu Apr 24, 2003 9:43 am


-----------------------------------
k, here's a big clue ......... tap champs
now guess
I need to noe more bout gui to come up with my own code  :oops: 
told u i need help

-----------------------------------
tomako
Thu Apr 24, 2003 9:47 am


-----------------------------------
if ya really wana noe who he is (which i do)
just go to his site and look around  8)

-----------------------------------
ZeroKelvin
Thu Apr 24, 2003 9:47 am


-----------------------------------
delta, i heard that ur good at gui, can you post the fixed code up so i can take a look?
thx

-----------------------------------
Lone]2
Thu Apr 24, 2003 9:50 am


-----------------------------------
a lot of people here go to milliken
cuz the teacher introduced
this site to us  :roll: 
heheheh

-----------------------------------
Prince
Thu Apr 24, 2003 9:54 am


-----------------------------------
wow, how many ppl go to milliken? and who r all these fellow milliken goers :D

-----------------------------------
Asok
Thu Apr 24, 2003 9:55 am


-----------------------------------
lol publicity at milliken!

 :D

-----------------------------------
ZeroKelvin
Thu Apr 24, 2003 10:03 am


-----------------------------------
quit talking bout milliken and gimme the code
btw i go to milliken too

-----------------------------------
Prince
Thu Apr 24, 2003 10:10 am


-----------------------------------
hey, buddy, this was my topic in the first place... dont demand code wen i was the original one askin for it

-----------------------------------
Delta
Thu Apr 24, 2003 10:11 am


-----------------------------------
I will see what I can do 
... but for the time being I have no internet except at school and sometimes on the weekend

-----------------------------------
MysticAngel
Thu Apr 24, 2003 10:26 am


-----------------------------------
prince in ur code what does this line mean


GUI.CreateTextFieldFull (115, maxy - 60, 90, realstr (n, 0),
        NEntered, GUI.INDENT, 0, 0)
[/quote]

-----------------------------------
MysticAngel
Thu Apr 24, 2003 10:43 am


-----------------------------------
prince u know in ur code, the porcedures NEntered and REntered are the values that u get from the user rite? can u say like n := NEntered and r := REntered ?

-----------------------------------
Prince
Thu Apr 24, 2003 10:48 am


-----------------------------------
k that line creates a text field for the value to b put in... and no ur way wont work cus since procedures dont return single value, i cant get anythin out of it... i could make it a function but then im afraid i might screw up the rest of it :?

-----------------------------------
ZeroKelvin
Thu Apr 24, 2003 6:28 pm


-----------------------------------
sorry............
but i need help bad  :cry:

-----------------------------------
MysticAngel
Thu May 01, 2003 9:38 am


-----------------------------------
prince, did u try like making the variables in the calcualate procedure -- the n1 and n2 as GUI.GetText ??? try that that might work

-----------------------------------
ZeroKelvin
Thu May 01, 2003 9:59 am


-----------------------------------
im kinda finished, but it's not perfect
if you guys can look over it that would be great, thx

import GUI in "%oot/lib/GUI"
View.Set ("graphics:400;300")
var Num1TextField, Num1Label, Num2TextField, Num2Label : int
var PermButton, ComboButton, menu, item1 : int
var num1, num2 : int
var text1, text2 : string

% ========== Procedure Nothing ==========
procedure Nothing (nothing : string)
    % Does nothing
end Nothing

% ========== Function Factorial ==========
function Factorial (x : int) : int
    var z : int := 1
    for y : 1 .. x
        z := y * z
    end for
    result z
end Factorial

% ========== Function Permutation ==========
function Permutation (x, y : int) : real
    result Factorial (x) / Factorial (x - y)
end Permutation

% ========== Function Combination ==========
function Combination (x, y : int) : real
    result Factorial (x) / (Factorial (y) * Factorial (x - y))
end Combination

% ========== Procedure QuitPressed ==========
procedure QuitPressed
    GUI.Quit
end QuitPressed

% ========== Procedure PermPressed ==========
procedure PermPressed
    num1 := strint (GUI.GetText (Num1TextField))
    num2 := strint (GUI.GetText (Num2TextField))
    locate (17, 10)
    put "                                                           "
    locate (17, 10)
    if num1 >= num2 and num1 > 0 and num2 > 0 then
        put "The Permutation is ", Permutation (num1, num2)
    else
        put "Incorrect Data - Try Again"
    end if
end PermPressed

% ========== Procedure ComboPressed ==========
procedure ComboPressed
    num1 := strint (GUI.GetText (Num1TextField))
    num2 := strint (GUI.GetText (Num2TextField))
    locate (17, 10)
    put "                                                           "
    locate (17, 10)
    if num1 >= num2 and num1 > 0 and num2 > 0 then
        put "The Combination is ", Combination (num1, num2)
    else
        put "Incorrect Data - Try Again"
    end if
end ComboPressed

% ----------========== Main Program ==========----------

menu := GUI.CreateMenu ("File")
item1 := GUI.CreateMenuItem ("Quit", GUI.Quit)
Num1Label := GUI.CreateLabelFull (50, 230, "First Number", 100, 0,
    GUI.CENTER, 0)
Num1TextField := GUI.CreateTextFieldFull (50, 200, 100, "", Nothing,
    GUI.INDENT, 0, 0)
Num2Label := GUI.CreateLabelFull (250, 230, "Second Number", 100, 0,
    GUI.CENTER, 0)
Num2TextField := GUI.CreateTextFieldFull (250, 200, 100, "", Nothing,
    GUI.INDENT, 0, 0)
PermButton := GUI.CreateButton (75, 150, 100, "Permutations", PermPressed)
ComboButton := GUI.CreateButton (225, 150, 100, "Combinations", ComboPressed)

loop
    exit when GUI.ProcessEvent
end loop
cls
var quitMessage := GUI.CreateLabelFull (0, 0, "Execution Terminated", maxx, 
    maxy - 135, GUI.CENTER + GUI.MIDDLE, 0)
delay (1000)
Window.Hide (defWinID)

thx again

-----------------------------------
Prince
Thu May 01, 2003 10:24 am


-----------------------------------
WOOHOOOOOOOOOOO!!!!!!!!!!! ive finally figured this sonofabitch out... thnx in large part to my teacher, the GUI guide on holt software's website and MysticAngel's idea of Gui.GetText... y i couldnt figure out sumthin so simple wen i started this damn thing i dont kno :?

-----------------------------------
Prince
Thu May 01, 2003 10:28 am


-----------------------------------
its still not workin perfectly :evil: ... but at least its workin now :)

*note: problem solved

-----------------------------------
ZeroKelvin
Thu May 01, 2003 10:34 am


-----------------------------------
you're program is working fine but all you need to do is to clear the label
i did it the stupid way (take a look at my program above)
i see if you  can find a better way

-----------------------------------
Office of the Registar
Fri May 02, 2003 8:43 am


-----------------------------------
its still crashable; according to rubric
you have to edit the inputs still

-----------------------------------
ZeroKelvin
Fri May 02, 2003 9:47 am


-----------------------------------
yo, Office of the Registar, which program are you talking bout?
me or prince? :?:

-----------------------------------
Prince
Fri May 02, 2003 9:58 am


-----------------------------------
well if u go by everything the rubric says yea its still crashable... but theres still error checking in it (if r is greater than n it switches the two around, got that idea from sumone on this board :wink: ) but other then that and the fact that the stupid label at the bottom wont clear its perfect

-----------------------------------
ZeroKelvin
Fri May 02, 2003 10:20 am


-----------------------------------
take a look at my program, i've found a way to clear the label
but see if you can find a better way to do it

-----------------------------------
Office of the Registar
Fri May 02, 2003 10:25 am


-----------------------------------
just use strintok to check it

-----------------------------------
Prince
Fri May 02, 2003 10:28 am


-----------------------------------
i do use it :?

-----------------------------------
ZeroKelvin
Fri May 02, 2003 10:37 am


-----------------------------------
but it still crashes if you enter text instead of numbers,
how do you fix that problem?  :(

-----------------------------------
Office of the Registar
Fri May 02, 2003 10:39 am


-----------------------------------
what do you mean
use strintok with an if statement

-----------------------------------
ZeroKelvin
Fri May 02, 2003 10:45 am


-----------------------------------
that's wut Prince did, look at his program  :evil:

-----------------------------------
Office of the Registar
Fri May 02, 2003 1:49 pm


-----------------------------------
actually,
stintok is used only when you enter a value in the text box and press enter

you didn't use it in your procedure in which calculates the permutation/combination to check if the user entered feasible data without pressing enter and calling up the procedure

-----------------------------------
Drakonius
Mon May 05, 2003 9:57 am


-----------------------------------
check the topic i started earlier, that was like a long version of strintok that didn't crash

-----------------------------------
vexd
Mon Nov 10, 2003 7:03 pm


-----------------------------------
omg hey kiddos, now that ur all in gr12, im in gr11 :)

well anyways LOL if u failde comp sci and are taking it again, lemme knowi aced all this ... :)ill post the code if you need it


and if it isnt obvious...i goto milliken also, and no teacher told me about this site... *shock*

neways yea, hi milliken ppl :)
