Welcome! Log In Create A New Profile

Advanced

Assignment 2

Posted by basicgerm 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Assignment 2
March 10, 2010 09:46AM
And the plot thickens.

How are we all doing?
avatar Re: Assignment 2
March 10, 2010 09:47AM
has anyone managed to defeat question 1.3.

Here's my code:
Language: Delphi
procedure TfrmWhatScore.btnResultClick(Sender: TObject); var Score1, Score2 : Integer; begin Score1 := sedScore1.Value; Score2 := sedScore2.Value; if Score1 > Score2 then begin Score1 := sedScore1.Value; Score2 := sedScore2.Value; lblResult.Caption := edtTeamName1.Text + ' beat ' + edtTeamName2.Text + '.' + 'The score was' + IntToStr(Score1) + '-' + IntToStr(Score2); lblVenue.Caption := 'The match was played at' + '' + [b]rgpStadium[/b];

The bolded syntax is giving an error. How do i get it to reference and display the selected radio button in the rgpStadium group box.
avatar Re: Assignment 2
March 11, 2010 01:26PM
I'm doing nothing, will only look at this in a weeks time ....

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
Re: Assignment 2
March 11, 2010 02:47PM
I got that question right by using many if statements that first check if a certain radio button is checked and then if the one score is bigger than the other.
Re: Assignment 2
March 11, 2010 03:12PM
lbl.caption := rgp.Items[2];.//example
this way you can tell whats on the index

--------------------------------------------------------------------
In a long journey, even a matchstick is heavy...
avatar Re: Assignment 2
March 11, 2010 06:15PM
Aragorn Wrote:
-------------------------------------------------------
> I got that question right by using many if
> statements that first check if a certain radio
> button is checked and then if the one score is
> bigger than the other.


I was hoping there was a way to avoid that.

Crazy j Wrote:
-------------------------------------------------------
> lbl.caption := rgp.Items[2];.//example
> this way you can tell whats on the index

I'll look at this after work, thanx
avatar Re: Assignment 2
March 11, 2010 10:25PM
Crazy j Wrote:
-------------------------------------------------------
> lbl.caption := rgp.Items[2];.//example
> this way you can tell whats on the index


hold on, I don't understand this code. Would you mind going a bit into details please.
avatar Re: Assignment 2
March 12, 2010 01:17PM
Why:

Language: Delphi
... begin Score1 := sedScore1.Value; Score2 := sedScore2.Value; if Score1 > Score2 then begin Score1 := sedScore1.Value; Score2 := sedScore2.Value; ...


Variables are only local in a function, not in an if statement and you are duplicating code here.

Instead:

Language: Delphi
... begin Score1 := sedScore1.Value; Score2 := sedScore2.Value; if Score1 > Score2 then begin lblResult.Caption := edtTeamName1.Text + ' beat ' + edtTeamName2.Text + ...

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 12, 2010 01:55PM
Hi. I will be doing some work on this on the weekend, so I do not know the data type of rgpStadium. A caption requires text.
avatar Re: Assignment 2
March 12, 2010 07:41PM
@cbrunsdonza
I realized that last night and fixed it, thanx.

The one problem I have now is to have the 'ItemIndex' property of rgpStadium set at '0'.

When i do it this way, the itemIndex works but I don't know how to reference the RadioButtons during design time.:
Language: Delphi
begin rgpStadium.Items.Add('SoccerCity'); rgpStadium.Items.Add('Loftus'); rgpStadium.ItemIndex := 0;

adding a GroupBox and a bunch of radiobuttons into it works with referencing the radio buttons, but I have no clue how to set the ItemIndex := 0;. I don't even see an ItemIndex in the Properties box thingy.
Re: Assignment 2
March 12, 2010 09:07PM
Its imposible it has to be there, check again unless ur delphi software is not complete.


itemIndex gives the index of the selected radiobutton and item returns the name that is stored in the specified index

--------------------------------------------------------------------
In a long journey, even a matchstick is heavy...
avatar Re: Assignment 2
March 15, 2010 01:59PM
hey yah.I was woundering is it possible to make a digital copy of the form in Delphi coz my printer's messed up and I neeed this print out...
avatar Re: Assignment 2
March 15, 2010 02:17PM
Quote

hey yah.I was woundering is it possible to make a digital copy of the form in Delphi coz my printer's messed up and I neeed this print out...

Print screen should work well.

or
Alt-PrintScr just for the active window.
Re: Assignment 2
March 15, 2010 04:28PM
oh Lord the more posts i read the more freaked out i get
avatar Re: Assignment 2
March 16, 2010 06:40PM
Think I'll tackle the delphi tonight .... before I leave till end of month

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 16, 2010 09:50PM
Mkay, question 1 is down and was lots of fun. 1.1 took me the longest to "answer" as I was a bit confused as to what they actually wanted.

Only thing that gets me is the submission requirements as per UNISA sevice guide. What a waste of space to set the margins as per their requirement.


Oh well, question 2 for 2morrow night.

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 22, 2010 11:14AM
Not enjoying Question3. My creativity is limited today.

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 22, 2010 02:06PM
haven't begun with Q2 yet. cant get my head around this DO and WHILE thingies. maybe I should just answer like a parrot and stop stressing myself - problem will be with the actual programming.

Q3,
for those marks? I'm guessing something that will inform about the score and perhaps the match dates, maybe
avatar Re: Assignment 2
March 22, 2010 02:42PM
Just done and submitted. I did a cute little "air travel" ticket calculator app between destinations. Decided to keep it simple and only do what was required.


aaarrgggh crap ... I see I submitted the wrong screenshot for 3.2, let me quikly fix that


... ok done, now I can concentrate on my ICT262{1,2}

--------------------------------------------------------------
Don't Assume Everything is a Nail Just Because You Have a Really Big Hammer
avatar Re: Assignment 2
March 22, 2010 05:03PM
A groupbox does not have itemindex. The radiogroup does. Add items to Items property, like you do to the listbox.
Then you can set or read the itemindex property.
ie: 5 items will be 0 to 4. On the form, selecting the 3 item, then itemindex will be 2.
Sorry, only registered users may post in this forum.

Click here to login