Board index » delphi » String Grid Question

String Grid Question

Combobox1.Items.Text := 'one'#13#10'Two'#13#10'Three';

but which delphi version are u using ?

GRS a crit dans le message <7con6s$ds...@remarQ.com>...
|Does anyone know how to put multiple lines of text on in a string grid
cell.
|
|I tried '#10#13' in various configurations but did not succeed.
|
|thanks
|
|

 

Re:String Grid Question


Olivier,

I am using Delphi 4.0

Following are the code snippets which will show what I am trying to do.
Basically I just want to print
in a cell  82
           $52

but it comes out 82#13#1052

Thanks for you consideration and help. Notice that it is a string grid not a
combo box. thanks again

type
  TfrmMain = class(TForm)
    strGrdAttackTab: TStringGrid;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  ..etc

procedure TfrmMain.Button1Click(Sender: TObject);
var
  I, J, K : Integer;
  strInfo : String;
begin
  K := 0;
  with strGrdAttackTab do
    for J:= RowCount - 1 downto 0 do
      for I := 0 to ColCount - 1 do
        begin
          strInfo := IntToHex(K,2) + '#13#10' + IntToStr(K);
          Cells[I,J] := strInfo;
          K := K + 1;
        end;
end;

Quote
olivier dahan wrote in message <7cqh75$ak...@oceanite.{*word*104}cable.fr>...

>Combobox1.Items.Text := 'one'#13#10'Two'#13#10'Three';

>but which delphi version are u using ?

>GRS a crit dans le message <7con6s$ds...@remarQ.com>...
>|Does anyone know how to put multiple lines of text on in a string grid
>cell.
>|
>|I tried '#10#13' in various configurations but did not succeed.
>|
>|thanks
>|
>|

Re:String Grid Question


Quote
GRS wrote:
> Following are the code snippets which will show what I am trying to do.
> Basically I just want to print
> in a cell  82
>            $52

> but it comes out 82#13#1052

> Thanks for you consideration and help. Notice that it is a string grid not a
> combo box. thanks again

> type
>   TfrmMain = class(TForm)
>     strGrdAttackTab: TStringGrid;
>     Button1: TButton;
>     procedure Button1Click(Sender: TObject);
>   ..etc

> procedure TfrmMain.Button1Click(Sender: TObject);
> var
>   I, J, K : Integer;
>   strInfo : String;
> begin
>   K := 0;
>   with strGrdAttackTab do
>     for J:= RowCount - 1 downto 0 do
>       for I := 0 to ColCount - 1 do
>         begin
>           strInfo := IntToHex(K,2) + '#13#10' + IntToStr(K);
>           Cells[I,J] := strInfo;
>           K := K + 1;
>         end;
> end;

You are getting exactly what you asked for... What you wanted you wanted to do is:

 strInfo := IntToHex(K,2) + #13 + #10 + IntToStr(K);

and I don't think the #10 is needed?

Gary

Re:String Grid Question


Leaving the quote ('#13#10') out does not work either. I believe that the
stringGrid.Cells takes a String and nothing will work. Beginning to think
that have to use a StringGrid.Objects but I do not know how yet.

Quote
Gary wrote in message <36F1782F.FC1A3...@futureone.com>...
>GRS wrote:

>> Following are the code snippets which will show what I am trying to do.
>> Basically I just want to print
>> in a cell  82
>>            $52

>> but it comes out 82#13#1052

>> Thanks for you consideration and help. Notice that it is a string grid
not a
>> combo box. thanks again

>> type
>>   TfrmMain = class(TForm)
>>     strGrdAttackTab: TStringGrid;
>>     Button1: TButton;
>>     procedure Button1Click(Sender: TObject);
>>   ..etc

>> procedure TfrmMain.Button1Click(Sender: TObject);
>> var
>>   I, J, K : Integer;
>>   strInfo : String;
>> begin
>>   K := 0;
>>   with strGrdAttackTab do
>>     for J:= RowCount - 1 downto 0 do
>>       for I := 0 to ColCount - 1 do
>>         begin
>>           strInfo := IntToHex(K,2) + '#13#10' + IntToStr(K);
>>           Cells[I,J] := strInfo;
>>           K := K + 1;
>>         end;
>> end;

>You are getting exactly what you asked for... What you wanted you wanted to
do is:

> strInfo := IntToHex(K,2) + #13 + #10 + IntToStr(K);

>and I don't think the #10 is needed?

>Gary

Re:String Grid Question


Will Chr(n) do the trick ?  

In article <921796271.156...@news.remarQ.com>, GRS <mary...@srv.net>
writes

Quote
>Leaving the quote ('#13#10') out does not work either. I believe that the
>stringGrid.Cells takes a String and nothing will work. Beginning to think
>that have to use a StringGrid.Objects but I do not know how yet.

<SNIP>
--
Keith Howell

Other Threads