| View previous topic :: View next topic |
| Author |
Message |
murn Guest
|
Posted: Mon Oct 27, 2003 9:43 am Post subject: TListBox |
|
|
Is there a way to disable the default behavior (selected item index is
changing when mouse is hold and moved up or down) when user presses and
holds the mouse button ?
I tryed enabled property but this isn't good because all events are disabled
(MouseDown,MouseMove,MouseUp).
Thanx a lot!
Milos
|
|
| Back to top |
|
 |
Kurt Barthelmess Guest
|
Posted: Mon Oct 27, 2003 10:36 am Post subject: Re: TListBox |
|
|
"murn" <miloo (AT) email (DOT) si> wrote:
| Quote: | Is there a way to disable the default behavior (selected item index is
changing when mouse is hold and moved up or down) when user presses and
holds the mouse button ?
|
Scrolling a list box by clicking on its scrollbar does not normally
change the item selection (ItemIndex.) It does not even change
activate the "OnClick" event. If you are getting that, something else
is wrong.
Clicking on an item does change the ItemIndex, but does not scroll the
box no matter what else you do.
Using the keyboard (arrow buttons, for example) does change the item
selection. The problem there would be to give the user a way to select
a new item. If the arrow key simply scrolled the listbox, how would
the user indicate which item they wnt to select?
Good luck.
Kurt
|
|
| Back to top |
|
 |
Chris Luck Guest
|
Posted: Tue Oct 28, 2003 3:44 am Post subject: Re: TListBox |
|
|
"murn" <miloo (AT) email (DOT) si> wrote
| Quote: | Is there a way to disable the default behavior (selected item index is
changing when mouse is hold and moved up or down) when user presses and
holds the mouse button ?
|
procedure TForm1.ListBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
end;
--
Regards,
Chris Luck.
|
|
| Back to top |
|
 |
murn Guest
|
Posted: Tue Oct 28, 2003 3:20 pm Post subject: Re: TListBox |
|
|
Thanx for the tip !
It works fine if user doesn't move the mouse out of listbox. If he does, the
MouseMove and MouseUp events dont start.
When (where) are this items drawed to listbox canvas (procedure that could
be overriden) ?
Regards Milos
|
|
| Back to top |
|
 |
Chris Luck Guest
|
Posted: Tue Oct 28, 2003 10:14 pm Post subject: Re: TListBox |
|
|
"murn" <miloo (AT) email (DOT) si> wrote
| Quote: | Thanx for the tip !
|
You're welcome.
| Quote: | It works fine if user doesn't move the mouse out of listbox. If he does, the
MouseMove and MouseUp events dont start.
|
Ah, well, that wasn't in the spec. :)
| Quote: | When (where) are this items drawed to listbox canvas (procedure that could
be overriden) ?
|
Would this do?
protected
procedure DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState); virtual;
--
Regards,
Chris Luck.
|
|
| Back to top |
|
 |
murn Guest
|
Posted: Wed Oct 29, 2003 9:16 am Post subject: Re: TListBox |
|
|
Hi!
| Quote: | protected
procedure DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState); virtual;
|
Yes this is the right place, but it stil draws a rectangle :(
But i found the way that works for me :)
pocedure MouseDown
ListBox.Items.BeginUpdate; //stop updating
procedure MouseUp
ListBox.Items.EndUpdate //resume updating
Thanx for your time.
Regards, Milos
|
|
| Back to top |
|
 |
|