gui program...
Author |
Message |
Prince
|
Posted: Thu Apr 24, 2003 10:10 am Post subject: (No subject) |
|
|
hey, buddy, this was my topic in the first place... dont demand code wen i was the original one askin for it |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delta
|
Posted: Thu Apr 24, 2003 10:11 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Apr 24, 2003 10:26 am Post subject: (No subject) |
|
|
prince in ur code what does this line mean
code: |
GUI.CreateTextFieldFull (115, maxy - 60, 90, realstr (n, 0),
NEntered, GUI.INDENT, 0, 0)
| [/quote] |
|
|
|
|
|
MysticAngel
|
Posted: Thu Apr 24, 2003 10:43 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Apr 24, 2003 10:48 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Apr 24, 2003 6:28 pm Post subject: (No subject) |
|
|
sorry............
but i need help bad |
|
|
|
|
|
MysticAngel
|
Posted: Thu May 01, 2003 9:38 am Post subject: (No subject) |
|
|
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
|
Posted: Thu May 01, 2003 9:59 am Post subject: (No subject) |
|
|
im kinda finished, but it's not perfect
if you guys can look over it that would be great, thx
code: |
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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Prince
|
Posted: Thu May 01, 2003 10:24 am Post subject: (No subject) |
|
|
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
|
Posted: Thu May 01, 2003 10:28 am Post subject: (No subject) |
|
|
its still not workin perfectly ... but at least its workin now
*note: problem solved |
|
|
|
|
|
ZeroKelvin
|
Posted: Thu May 01, 2003 10:34 am Post subject: (No subject) |
|
|
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
|
Posted: Fri May 02, 2003 8:43 am Post subject: (No subject) |
|
|
its still crashable; according to rubric
you have to edit the inputs still |
|
|
|
|
|
ZeroKelvin
|
Posted: Fri May 02, 2003 9:47 am Post subject: (No subject) |
|
|
yo, Office of the Registar, which program are you talking bout?
me or prince? |
|
|
|
|
|
Prince
|
Posted: Fri May 02, 2003 9:58 am Post subject: (No subject) |
|
|
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 ) but other then that and the fact that the stupid label at the bottom wont clear its perfect |
|
|
|
|
|
ZeroKelvin
|
Posted: Fri May 02, 2003 10:20 am Post subject: (No subject) |
|
|
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 |
|
|
|
|
|
|
|