Probably a silly question.. but im new to delphi :)

Reply

Join Date: Jul 2009
Posts: 17
Reputation: revski is an unknown quantity at this point 
Solved Threads: 0
revski revski is offline Offline
Newbie Poster

Probably a silly question.. but im new to delphi :)

 
0
  #1
Jul 3rd, 2009
hi,

i havent been programming in delphi long so sorry if im being stupid with this question.

my application basically has a trackbar which alters the value of a label caption.

and 2 text boxes.

that value of the 1st text box is the Caption of the label * the text in the 2nd text box.

what i would like to know is, how do i make this value automatically update each time the slider is moved and the label caption changes.

appreciate the help
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 5
Reputation: andrevanzuydam is an unknown quantity at this point 
Solved Threads: 0
andrevanzuydam's Avatar
andrevanzuydam andrevanzuydam is offline Offline
Newbie Poster

Re: Probably a silly question.. but im new to delphi :)

 
0
  #2
Jul 3rd, 2009
Remember Delphi is strongly typed so you need to type cast your calculations as below:

Pascal and Delphi Syntax (Toggle Plain Text)
  1. Edit1.Text := StrToInt (Label1.Caption) * StrToInt(Edit2.Text);

You should probably put this in the appropriate event on the Slider control, OnChange should be a good one.
Last edited by andrevanzuydam; Jul 3rd, 2009 at 10:03 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 17
Reputation: revski is an unknown quantity at this point 
Solved Threads: 0
revski revski is offline Offline
Newbie Poster

Re: Probably a silly question.. but im new to delphi :)

 
0
  #3
Jul 3rd, 2009
sorry i didnt explain the situation very well in the first place i missed a serious point off.

the initial value of the calculations is made by a button on the form, this is because they are standard set values by the factory for that machine, but the value would alter depending on the position of the trackbar.

so what im asking is as the value of the trackbar goes up or down, it needs to update the value of the text box automatically.

im unsure how to do this because there is an original calculation performed by a button click.

but the value of the label will change each time the trackbar is moved.

i have only the calculation in the OnClick event of the button, in the OnChange event of the trackbar it increases or decreases the value of the label.

Sorry for not explaining this clearer the first time.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 5
Reputation: andrevanzuydam is an unknown quantity at this point 
Solved Threads: 0
andrevanzuydam's Avatar
andrevanzuydam andrevanzuydam is offline Offline
Newbie Poster

Re: Probably a silly question.. but im new to delphi :)

 
0
  #4
Jul 4th, 2009
A label doesn't have a OnChange event so you may want to replace the label with a TEdit (you can adjust the properties to make it look like a label) and then make the OnChange event on that do the same calculation as the button - if that is what you need it to be achieved. Another thought is that you should have a function or procedure to do the calculations which automatically update all the correct TEdits and labels when an event is fired. It would be good if you could paste some code, I am still not clear on what you need to achieve.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC