Posted: Tue Jul 02, 2002 9:03 pm
Restored from previous forum. Originally posted by cor.
Purebasic crashes if you use getgadgetstate from a Listviewgadget whithin the StartDrawing command.
Below is a sample code
If EventID = #PB_EventGadget
Case 5 ;Listview event
variationstate=GetGadgetState(5)
If you use variationstate all is working ok
If you change variationstate to GetgadgetState(5) directly in the code
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Purebasic crashes if you use getgadgetstate from a Listviewgadget whithin the StartDrawing command.
Below is a sample code
If EventID = #PB_EventGadget
Case 5 ;Listview event
variationstate=GetGadgetState(5)
If you use variationstate all is working ok
If you change variationstate to GetgadgetState(5) directly in the code
Code: Select all
cl.l
StartDrawing(WindowOutput())
DrawingFont(UseFont(0))
DrawImage(UseImage(0), #xoffset, #yoffset)
Protected k
For k = 1 To #nrstrings
;For k = 3 To 5
Select stringpos(k)
Case 0
Locate(#xdiagram-2+(#stringwidth*k-1),#yfretpos-20)
DrawText("o")
Locate(#xdiagram-2+(#stringwidth*k-1),#ydiagram+(#stringheight*16+8))
; tmp.s=sname(k,dotnamepos(k))
DrawText(sname(k,dotnamepos(k)))
Case -1 ; was -1
Locate(#xdiagram-2+(#stringwidth*k-1),#yfretpos-20)
DrawText("x")
Default
If gevondenlijst(variationstate,k)=RootName ; change variationstate to GetgadgetCode(5) and PB crashes
cl=RGB(0,200,0)
Else
cl=RGB(0,0,0)
EndIf
;
Circle (#xfretpos+(#stringwidth*(k-1)),stringpos(k),6,cl)
FrontColor(0,0,0)
Locate(#xdiagram-2+(#stringwidth*k-1),#ydiagram+(#stringheight*16+8))
; tmp.s=sname(k,dotnamepos(k))
DrawText(sname(k,dotnamepos(k)))
EndSelect
Next k
tmp1.l=(20*(FretSpanStart))
tmp2=(20*(FretSpan))
DrawingMode(4)
Box(25,#ydiagram+5+tmp1,135,21+tmp2,RGB(255,0,0))
StopDrawing()
; Display ChordName in statusbar
If Left(RootName,2) " "
tmpRootName.s=RootName+ " "
EndIf
StatusBarText(0,0,tmpRootName+ChordTypeName,4)
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com