[Gambas-user] Simple list view check question

jbskaggs jbskaggs at ...1871...
Mon Mar 31 02:02:57 CEST 2008


Thank you- I will study this and see if it works for me.

JB Skaggs



richard terry-2 wrote:
> 
> 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
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-list-view-check-question-tp16388895p16389485.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list