BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TListBox

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
murn
Guest





PostPosted: Mon Oct 27, 2003 9:43 am    Post subject: TListBox Reply with 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 ?

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





PostPosted: Mon Oct 27, 2003 10:36 am    Post subject: Re: TListBox Reply with quote



"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





PostPosted: Tue Oct 28, 2003 3:44 am    Post subject: Re: TListBox Reply with quote




"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





PostPosted: Tue Oct 28, 2003 3:20 pm    Post subject: Re: TListBox Reply with quote

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





PostPosted: Tue Oct 28, 2003 10:14 pm    Post subject: Re: TListBox Reply with quote

"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





PostPosted: Wed Oct 29, 2003 9:16 am    Post subject: Re: TListBox Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.