Results 1 to 7 of 7

Thread: Quick Delphi Control Question...

  1. #1

    Quick Delphi Control Question...

    What control should I use if I want to create a list of selectable strings where each string resides in it's own column (left to right). An example of this would be the attachement list in Outlook Express. I can't seem to find a control that will do this nicely without scrollbars. Basically I want a horizontal listbox...
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

  2. #2
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Quick Delphi Control Question...

    What about List view?

    Or use a liust box but owner draw a sub list into a single line with your own formatting.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Quick Delphi Control Question...

    If you are really stuck on Standard VCL/CLX components youcan always try TMS Software... http://www.tmssoftware.com/

    They have a nice selection for Delphi/Kylix components. And they are working to support Delphi 2005 for all existing components offered.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #4

    Quick Delphi Control Question...

    I've never done any ownerdraw stuff before... does anyone have any links to soem tutorials or examples?
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

  5. #5

    Quick Delphi Control Question...

    What about StringGrid ?
    Look at the sources, i have made some components myself and i can tell you the first step is harder
    The future must be... Fast and OpenSource so...
    <br />Think Open and Lightning Fast!

  6. #6

    Quick Delphi Control Question...

    StringGrid seems to work okay, but I'm having trouble getting the column widths to align to the size of the string. Strings that are too small leave a lot of space, ones that are too big get cut off. What is the easiest way to determine the pixel length of a string?

    Doh' seems it's real easy... Canvas.TextWidth('string goes here') + 5;

    Seperate question though... when I click a cell it gets focus, but it doesn't darken as a selection. Is there a way to get the cell to highligh as a selection. I've checked through the methods provided for a TStringGrid but haven't found what I'm looking for.
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

  7. #7

    Quick Delphi Control Question...

    Took me a bit, but I think I go it...

    I used the onDrawCell Event and checked for a selection to draw gray as the background, here is the code I used.

    [pascal][background=#FFFFFF][comment=#8080FF][normal=#000080]
    [number=#C00000][reserved=#000000][string=#00C000]
    procedure Tfrm_Main.grd_AttachDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
    var
    S: string;
    begin
    with (Sender as TStringGrid) do begin
    S := Cells[ACol, ARow];
    if (gdSelected in State) then begin
    with Canvas do begin
    Brush.Color := clLtGray;
    FillRect(Rect);
    TextOut(Rect.Left + 2, Rect.Top + 2, S);
    end;
    end;
    end;
    end;


    [/pascal]
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •