[Gambas-user] Getting wrong text item from listtview
skaggs
jbskaggs at ...1871...
Sun Apr 6 22:59:43 CEST 2008
Okay its a bit long but:
here we click listview1 to pick the chapter we work on:
PUBLIC SUB ListView1_Click()
DIM thislist AS String
DIM elt AS String[]
DIM sb AS String
DIM c AS Integer
DIM t AS String
DIM cwc AS Integer
DIM twc AS Integer
DIM v AS Integer
DIM z AS Integer
'listview1.MoveTo(z)
IF listview1.count > 0
ListView1.MoveCurrent
cwc = 0
txChWordCount.text = 0
TextArea3.Text = ""
TextArea3.hide
IF Exist(PrThing.projectpath &/ listview1.Item.Text & "scenelist")
thislist = Left$(file.Load(PrThing.projectpath &/
listview1.Item.Text & "scenelist"), -1)
'print thislist
elt = Split(thislist, "^")
listview2.Clear
FOR EACH sb IN elt
c += 1
listview2.Add(c, sb)
t = file.Load(PrThing.projectpath &/ listview1.Item.Text & sb)
cwc += Round(Len(t) / 6) - 1
txChWordCount.Text = cwc
NEXT
END IF
TextLabel7.Hide
moviebox1.Hide
TextBox6.Hide
Button1.Hide
Button2.Hide
Textbox7.text = 0
ENDIF
END
then we click listview2 to pick the scene we are working on:
PUBLIC SUB listview2_Click()
DIM t1 AS String
DIM elt AS String[]
DIM sb AS String
DIM c AS Integer
DIM thislist AS String
IF ListView2.count < 1
'ListView1.MoveCurrent
textbox6.Clear
message.Error("You have not added any scenes yet. Right Click on
chapters to add a scene.")
RETURN
ENDIF
t1 = "empty"
elt = ""
sb = ""
c = 0
textbox6.Clear
TextArea3.Text = t1
TextArea3.Hide
moviebox1.hide
message.Info(PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text)
IF Exist(PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text)
t1 = file.Load(PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text)
textarea3.show
END IF
TextArea3.Text = t1
TextLabel7.Show
TextBox6.Show
Button1.Show
Button2.Show
moviebox1.Refresh
IF Exist(PrThing.projectpath &/ "characters/characterlist.txt") = TRUE
IF Exist(PrThing.projectpath &/ "characters/" & listview1.Item.text &
Listview2.Item.text & "char.txt") = TRUE
textbox6.text = file.load(PrThing.projectpath &/ "characters/" &
listview1.Item.text & Listview2.Item.text & "char.txt")
ELSE
RETURN
ENDIF
IF Exist(PrThing.projectpath &/ "characters/" & TextBox6.Text &
".txt") = TRUE
thislist = file.Load(PrThing.projectpath &/ "characters/" &
TextBox6.text & ".txt")
elt = Split(thislist, "^")
ListView3.Clear
FOR EACH sb IN elt
c += 1
IF c = 8 THEN gifpic = sb
NEXT
ENDIF
IF Exist(gifpic) = TRUE
moviebox1.Path = (gifpic)
moviebox1.Show
moviebox1.playing = TRUE
ELSE
MovieBox1.hide
ENDIF
ELSE
IF Exist(PrThing.projectpath &/ "characters/" & listview1.Item.text &
Listview2.Item.text & "char.txt")
KILL PrThing.projectpath &/ "characters/" & listview1.Item.text &
Listview2.Item.text & "char.txt"
MovieBox1.hide
ENDIF
ENDIF
textbox7.text = Round(Len(t1) / 6) - 1
END
Okay then we right click to access menu
PUBLIC SUB listview2_Menu()
IF listview2.count > 0
text.Popup
ELSE
message.Info("NO scenes exist! Right click on a chapter to add a
Scene.")
ENDIF
END
then we click on edit scene text to edit file
PUBLIC SUB text_edit_Click()
DIM t1 AS String
textpath = ""
textfile = ""
t1 = ""
TextArea3.Text = t1
'ListView1.MoveCurrent
'ListView2.Item.Selected = TRUE
IF Exist(PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text) = TRUE
textfile = file.Load(PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text)
END IF
textpath = PrThing.projectpath &/ listview1.Item.Text &
listview2.Item.Text
FScnTextEditor.Show
END
every whereelse on this chain listview1.item.text is the correct
chapter- then when this last stage is clicked it always points to
chapter 1 (or the firstitem in listview1)
JB Skaggs
On Sun, 2008-04-06 at 16:51 -0400, Stephen Bungay wrote:
> Code example?
>
> jbskaggs wrote:
> > I dont know why i keep having new listview bugs pop up. But this time I keep
> > getting the firstitem's text in a listviewreference that everywhere else is
> > pointing to the right listview item.
> >
> > listview1_click() points and displays the right listview.item text
> > then when it goes to listview2_click is references the right item on
> > listview one
> > then when I click my listview2menu to edit a text file it edits the file and
> > saves with the right path (listview1.item.text
> > &/listview2.item.text&/"filename.txt"
> >
> > but when I goto edit same file it always calls the first listview1.item in
> > the path and can't find the file. I have scoured the code to find where I
> > am reassigning the variable or moving the cursor and I am not finding it.
> >
> > Is there a trick to finding the bug?
> >
> > JB Skaggs
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> Monday, April 7! Use priority code J8TLD2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list