Limiting Listbox Dragrow

Hi everyone,

I have a listbox containing 10 rows. I want the user to select a line comprised only between rows 3 to 10, and can’t move to the position of rows 1 and 2.

Could someone help me ?

Thanks

You can enforce that in the drag events. Look at the listbox docs for those.

  • Karen

If your ListBox have 10 Rows, you want to secure (unmove) Rows 0 and 1.

Ok Emile, but can you explain how secure rows 0 and 1 ? I don’t know how to do it.

Thanks.

Add an event DragReorderRows. In this event add something like

if me.listindex = 0 or me.listindex = 1 then return false

This is untested.

[quote=257255:@Beatrix Willius]Add an event DragReorderRows. In this event add something like

if me.listindex = 0 or me.listindex = 1 then return false

This is untested.[/quote]

OK Beatrix, but how to allow a line to be moved to a position between 2 and 10 but prevent it from being moved to the position 0 or 1 ?

We can’t write your app for you. Use the example Beatrix provided to expand upon.

I found the solution. I had not seen the NewPosition integer.

Thanks for your help.

Trying to debug with wrong # cannot lead to a solution IMHO. I do not meant anything rude.

NewPosition is here:
http://documentation.xojo.com/index.php/ListBox.DragReorderRows

Just for the others who, like me, did not notices that.

It maybe a bit late, but… why don’t you use two ListBoxs: one with two lines, the second below with all other 8 rows ?