[Gambas-user] Simple list view check question
richard terry
rterry at ...1822...
Mon Mar 31 01:16:34 CEST 2008
On Mon, 31 Mar 2008 10:01:30 am jbskaggs wrote:
> I have two list views
>
> listview1 and listview2
>
> I need a snippet of code to show me exactly how to make sure the listview
> items are on the one clicked by the mouse.
>
> I have tried:
> ListView1.MoveCurrent
>
> but if there is listview1.count<2 then I get a NULL error
>
> So I altred my code to :
>
> IF ListView1.Count > 1
> ListView1.MoveCurrent
> ENDIF
> listview1.Item.Selected = TRUE
>
> Now I get a stack overflow error.
>
> What I am doing is this:
>
> Listview1 holds the chapters
> Listview2 holds the scenes
>
> So if I edit a scene text it would be
>
> t1 = file.Load(projectpath &/ listview1.Item.Text & listview2.Item.Text)
>
> and so on and so forth- but when the program loses the focus on the
> listview items then I get either NULL object or File not found depending on
> the code.
>
> So How do I code to check the listview items properly?
>
> JB Skaggs
You must move the internal cursor to the currently selected item, then read
its key, and set it to selected to make the marquee appear on that row, as
per below.
I then use the click event to do whatever I want.
Put print statements in this routine to make sure your key is correct
Hope this is correct/helps/was what you meant
Public Sub ProblemLists_Select()
Select Case Last.tag
Case "active problems"
cvwProblemsActive.MoveCurrent
cvwProblemsActive.Item.Selected = True
sProblemKey = cvwProblemsActive.Item.key
Print "my key was:", cvwProblemsActive.Item.key
Case "inactive problems"
cvwProblemsInActive.MoveCurrent
cvwProblemsInActive.Item.Selected = True
sProblemKey = cvwProblemsInActive.Item.key
End Select
End
Public Sub ProblemLists_Click()
'-----------------------------------------------------------
'The user has clicked on either the active or inactive lists
'so display this problem in the editing area
'------------------------------------------------------------
EditArea_Problem_Display
End
More information about the User
mailing list