Hi, I want to learn whether any components such as coloured bars whose heights are automatically changing in the two values which comes from one editbox. If I write 50 to editbox, The colour bar will be half of its height automatically. If I write 75 to editbox, The colour bar will be cutted 25 percent of that bar. Can you give me any practical solution. I will add these bars to control the percentage situation of the value in edit boxes. I have tried to write code like below with image components that I design like a color bar.

procedure TAnaform.Memo29Change(Sender: TObject);
var
 a,i,sendcal_memo1,sendcal_memo2:integer;
begin
  for i := 29 to 35 do
   begin
      cal_memo1 := Strtoint(TMemo( FindComponent ( 'Memo' + strtoint( i-1 ) ) ).Text);
     cal_memo2 := Strtoint(TMemo( FindComponent ( 'Memo' + strtoint( i ) ) ).Text);
    if (Component is TImage)and (cal_memo1 < > 0) and (cal_memo2 < > 0) then
        TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Height :=
        TImage( FindComponent ( 'Barimage' + strtoint( i ) ) ).Height - TImage ( FindComponent ( 'Barimage' + strtoint( i ) ) ).Height * ( calculatebarheightpercent( sendcal_memo1,sendcal_memo2 ) );
        TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Top := TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Top + TImage ( FindComponent ( 'Barimage' + strtoint ( i ) ) ).Height * ( calculatebarheightpercent( sendcal_memo1,sendcal_memo2 ) );
   end;
end;

No, you'd have to roll your own. Try googling for "delphi barchart component". If that doesn't help, I'll see if I can whip-up something simple for you.

An edit component isn't going to display anything but text.

also,

not trying to be a code nazi here... I just dont know if you know :) No one told me this.

Post your code (which I had to learn when I was new as well) don't put any spaces in between your description of code.

[ CODE = Delphi ] should be without any spaces and it will come out how it is supposed to :)

Opps sorry guys. :).. I couldnt see the spaces during time when my head is like a drunk. :)


Hi, I want to learn whether any components such as coloured bars whose heights are automatically changing in the two values which comes from one editbox. If I write 50 to editbox, The colour bar will be half of its height automatically. If I write 75 to editbox, The colour bar will be cutted 25 percent of that bar. Can you give me any practical solution. I will add these bars to control the percentage situation of the value in edit boxes. I have tried to write code like below with image components that I design like a color bar.

procedure TAnaform.Memo29Change(Sender: TObject);
var
a,i,sendcal_memo1,sendcal_memo2:integer;
begin
for i := 29 to 35 do
begin
cal_memo1 := Strtoint(TMemo( FindComponent ( 'Memo' + strtoint( i-1 ) ) ).Text);
cal_memo2 := Strtoint(TMemo( FindComponent ( 'Memo' + strtoint( i ) ) ).Text);
if (Component is TImage)and (cal_memo1 < > 0) and (cal_memo2 < > 0) then
TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Height :=
TImage( FindComponent ( 'Barimage' + strtoint( i ) ) ).Height - TImage ( FindComponent ( 'Barimage' + strtoint( i ) ) ).Height * ( calculatebarheightpercent( sendcal_memo1,sendcal_memo2 ) );
TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Top := TImage(FindComponent ( 'Barimage' + strtoint( i ) ) ).Top + TImage ( FindComponent ( 'Barimage' + strtoint ( i ) ) ).Height * ( calculatebarheightpercent( sendcal_memo1,sendcal_memo2 ) );
end;
end;

Sorry duoas the bar charts is like a group not only one. So I need an only one bar stick in bar chart that works like a percentage color bar that changes according to my stock values. Our stock values work in kilos. 400 stock limit and 300 received stock limit. so the bar's height will decrease to 100/400 of bar height. I tried to do them by using and preparing images and calculating the image heights like a bar. but I couldnt succeed..

Ok my lovely teacher duoas, I barheightpercentage is a function that send two values which is entered using keyboard in memo text that I use like an edit box. I will look forward your simple code.... :)

Ok my lovely teacher duoas, I barheightpercentage is a function whom is sent two values which is entered using keyboard in memo text that I use like an edit box storing two stock values. I will look forward your simple code....:)

Why don't you google like I asked?

Try this.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.