Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: TListBox

  1. #1
    Join Date
    Mar 2007
    Location
    South Pacific
    Posts
    109

    TListBox

    I was wondering if the listbox with edit box can be converted into a tag editor? Playlist/Tag editor... Hmmm
    Last edited by Blueaura; 09-16-2007 at 05:25 AM. Reason: Moved: Please keep threads on topic and ask completely new/unrelated questions in new threads.
    Never be late for the way of the warrior... Musashi

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Of course it can, if you wanted to
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  3. #3
    Join Date
    Mar 2007
    Location
    South Pacific
    Posts
    109
    Good. So much to learn. Haven't even had time to try and make a component. And then, there's the inline assembler- that looks interesting. Some of this Delphi code has to get stripped down, otherwise you could end up with a monster MP3 player...

    Nice to see you back, too, Liz.

    Ok. TListbox. All the goods are there from the VTM. Um... needs drag and drop, moving items up, down with mouse, colored lines. That should do for now.

    Hey, Dan, you still out there?

    Hey, Buzz, hurry up with the next VTM. We need visualization. Need a metronome, too. .. never play in time.
    Never be late for the way of the warrior... Musashi

  4. #4
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Listbox can already do all those things you mention. You probably wont need to make a control to do it.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  5. #5
    Join Date
    Nov 2006
    Posts
    233
    Indeed, Drag and drop as well as moving items up and down has been mentioned on the forum recently with examples. I believe there is an example for coloured lines on delphi.about.com.
    Guide to Learning Delphi - A list of resources and tips. If you have a question read this.
    Delphi Fusion Delphi Articles and Forum
    My Blog - Random Delphi related ramblings by a hobby programmer.
    Delphi Fusion Team - Join my SETI@home and ClimatePrediction.Net Team

    You see what power is - holding someone else's fear in your hand and showing it to them!

  6. #6
    Join Date
    Jan 2007
    Posts
    216
    @Nahu: There is an excellent Example for visualization in the Bass help. It's called 'SampleVis'. If you have problems with taking the stuff out you want to have, feel free to ask.

  7. #7
    Join Date
    Mar 2007
    Location
    South Pacific
    Posts
    109
    Yep, thanks, Dragon
    Never be late for the way of the warrior... Musashi

  8. #8
    Join Date
    Mar 2007
    Location
    South Pacific
    Posts
    109

    Moving items in a TListBox using the mouse

    Here's code from Delphi3000.com, Christophe Geers, ANDROME nv, if anyone may be interested. I think Buzz and Logan are going to show us this stuff, anyway.
    .................................................. ................................
    ( from the tutorial )


    NOTE: This is just a small example that shows you this effect.

    The following steps have to be followed in order to obtain a working example:

    1. Set the dragmode property of the TListBox to dmAutomatic.

    Next, you'll have to provide two event handler for the DragDrop and the
    DragOver event of the TListBox.

    2. Put the following code in the DragOver event handler.

    procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X,
    Y: Integer; State: TDragState; var Accept: Boolean);
    var
    DropIndex: Integer;
    TempStr : String;
    begin
    with TListBox(Sender) do
    begin
    DropIndex := ItemAtPos(Point(X,Y), True);
    if (DropIndex > -1) and (DropIndex <> ItemIndex) then
    begin
    TempStr := Items[DropIndex];
    Items[DropIndex] := Items[ItemIndex];
    Items[ItemIndex] := TempStr;
    ItemIndex := DropIndex;
    end;
    end;
    end;

    3. And finally put this little of code in the DragDrop event handler.

    procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X,
    Y: Integer);
    var
    DropIndex: Integer;
    begin
    DropIndex := TListBox(Sender).ItemAtPos(Point(X,Y),False);
    with TListBox(Source) do
    begin
    TListBox(Sender).Items.Insert(DropIndex, Items[ItemIndex]);
    Items.Delete(ItemIndex);
    end;
    end;

    Voila, there you go. You should be able now to move items in a listbox
    using the mouse. This code also shows the item moving along through the
    other items while you drag it. The code can be easily adjusted to prevent
    this from happening. It's all pretty straight forward so I didn't bother
    to comment the code.

    Regards,

    Chris

    Tested with Delphi 6 Professional on WinXP Professional)
    Never be late for the way of the warrior... Musashi

  9. #9
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    So.. whats left out of your list now that you havent been able to do without a vtm?
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  10. #10
    Join Date
    Mar 2007
    Location
    South Pacific
    Posts
    109
    Hi Liz, i like to be shown the basics, and I like to develop from there. Don't forget, i might have to show somebody something sometime, and i would like to be able to do it in a elegant, simplified way- and without any mucking around. These simplified pieces of information are like grains of sand on the seashore- there's heaps more grains of sand. This is just the tip of the iceberg. As you are well aware, there's so much more to learn. I still think good basics are the most important thing to develop. The more you can put into the basics, ( and though it may seem the slow way ), the stronger, and faster, you will develop. these are proven method's, look at me
    Never be late for the way of the warrior... Musashi

Page 1 of 2 12 LastLast

Posting Permissions

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