programatically control columnview
Posted
#1
(In Topic #973)
Enthusiast

What I want to do is create a tablet mode giving me extra buttons on the screens with columnviews which will move the selection (not the item) up and down the list. I do not know what is in the list and the keys are not sequential.
For the life of me I can't find a way to do this. below is example code using non existing keywords but you will get the idea of what i want to do. Question is how?
public sub button_up_Click()
columview.selecteditem.selectnext
end sub
the idea of this would be to move the internal cursor and the view of the user to show the next item in the list has been selected. Is there a simple way?
Posted
Guru

sadams54 said
I have noticed an issue with columnview on fedora tablets. Making a selection does not select an item but instead brings up the on screen keyboard. I do not care why or how this happens I am assuming an issue in fedora.
What I want to do is create a tablet mode giving me extra buttons on the screens with columnviews which will move the selection (not the item) up and down the list. I do not know what is in the list and the keys are not sequential.
For the life of me I can't find a way to do this. below is example code using non existing keywords but you will get the idea of what i want to do. Question is how?
public sub button_up_Click()
columview.selecteditem.selectnext
end sub
the idea of this would be to move the internal cursor and the view of the user to show the next item in the list has been selected. Is there a simple way?
You must use (and read up on) the "internal cursor"
/comp/gb.qt4/columnview - Gambas Documentation
Eg..
Code (gambas)
- ' All okay so select the Views internal cursor "Item" property
Posted
Guru

When you say don't want to move the "Item" did you mean internal cursor "Item" property ?
or you don't want to "move" the list contents but just select the next up in which case the above code is a way.
Other thoughts.
using the Scroll method to move the list.
Posted
Guru

but suffice to say moving the internal cursor around is invisible to the user. you can use any combinations of the Movexxx commands to get it where you want then use the ColumnView.Item property to do something like select it or get it's data for a tooltip or something,
Posted
Enthusiast

Posted
Enthusiast

The button down is the same just replace LV.MovePrevious() with LV.MoveNext
As always thank you for the help
Code
Public Sub LVButtonUp(ByRef LV As ColumnView)
If LV.MoveCurrent() Then ' sets the cursor to current select, if nothing is selected the next line is called which sets the first item in list active
LV.MoveFirst()
Else
If LV.MovePrevious() Then Return ' moves cursor to previous item. if already there it exits
Endif
LV.Item.Selected = True ' selects the current item
LV.Item.EnsureVisible ' very important it shows the item is selected to the user.
End
1 guest and 0 members have just viewed this.



