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?
programatically control columnview
- BruceSteers
- Posts: 1884
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: programatically control columnview
You must use (and read up on) the "internal cursor"sadams54 wrote: ↑Monday 16th January 2023 8:42pm 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?
https://gambaswiki.org/wiki/comp/gb.qt4/columnview
Eg..
Public Sub btnMoveUp_Click()
If ColumnView1.MoveCurrent() Then Return ' move cursor to current item, MoveCurrent() returns true if there is no current item
If ColumnView1.MovePrevious() then Return ' if it returns true we are at top.
' All okay so select the Views internal cursor "Item" property
ColumnView1.Item.Selected = True
End
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1884
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: programatically control columnview
I may have misunderstood.
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.
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.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1884
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: programatically control columnview
Note there are differences between ColuumnView.MovePrevious() and ColumnView.MoveAbove()
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,
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,
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: programatically control columnview
I think I understand. I was looking up columnview but nothing was jumping out at me. gambas is such a simple language that I sometimes can't think simple enough to make something work. I will try what you suggested. you understood right the first time.
Re: programatically control columnview
The solution was not quite right but lead me the right path. I posted below the actual working code for those that may need. I made it a public sub so it can be called from several places in the project using any columnview.
The button down is the same just replace LV.MovePrevious() with LV.MoveNext
As always thank you for the help
The button down is the same just replace LV.MovePrevious() with LV.MoveNext
As always thank you for the help
Code: Select all
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