| | |
Probably a silly question.. but im new to delphi :)
Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2009
Posts: 17
Reputation:
Solved Threads: 0
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
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
Remember Delphi is strongly typed so you need to type cast your calculations as below:
You should probably put this in the appropriate event on the Slider control, OnChange should be a good one.
Pascal and Delphi Syntax (Toggle Plain Text)
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.
•
•
Join Date: Jul 2009
Posts: 17
Reputation:
Solved Threads: 0
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.
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.
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.
![]() |
Similar Threads
- Delphi appointments? driving me mad! (Pascal and Delphi)
- Silly Questions (Geeks' Lounge)
- A question on wrapper class constructor behaviour (Java)
- PoE Question (Networking Hardware Configuration)
- newbie question (PHP)
- MySQL++ query question (C++)
- Ajax Question (ASP.NET)
- possibly ignorant question about the stack (C)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Multithread+BDE+Oracle database Error
- Next Thread: Please help me with calculation in delphi.
| Thread Tools | Search this Thread |





