iGlass - IGL_Progress bug

BlitzMax Forums/BlitzMax Programming/iGlass - IGL_Progress bug

siread(Posted 2006) [#1]
I have found a bug in IGL_Progress. When the progress bar is drawn it adds the value of the progress bar to the length of the bar. This means the bar gets longer as the percentage gets higher! Anyone know anything about this?

Also, I would like to know if there are any plans to update iGlass as it's been a while. I understand that unicode isn't supported? ;)

What's the score filax? :D


Filax(Posted 2006) [#2]
Can you post an example to show the bug please ?

For the IGlass update, don't panic, i'm finishing TerraEd
update and EasyTOK ragdoll and next i'll re - work under bmax :)

But for the moment i finish my holidays, and i buy an
apartment, in France it is really very complicated to do :(((


siread(Posted 2006) [#3]
Ok, i've fixed it now. Here is what was happening when I set the first progress bar value to 30 in the create command and the second one to 0.



So i looked in Inc_Progress.bmx and added this line to the Create function:
Local Tmp_Value:Int=(Value*Tx)/Maximum


And changed the following slightly (-Tmp_Value):
NewProgress.Image_ProgressBar=IGL_LoadBorderImage(IGL_Progress_Bar,Tx-2-Tmp_Value,Ty-2,Null,Null,0)


I also needed to add this to the Refresh function just before "IGL_DrawImage(Image_ProgressBar..." so that the progress bar is adjusted if you use SetValue at any point after creating the progress bar.
Image_ProgressBar.width = Tx-2-Tmp_Value


It seems to work fine now and i'm chuffed. :D


Filax(Posted 2006) [#4]
Ok if i follow you :

=>> Local Tmp_Value:Int=(Value*Tx)/Maximum
NewProgress.Label=IGL_Label.Create(NewProgress.ID,NewProgress.Caption,Tx/2,(Ty/2)-(IGL_FontHeight/2),2,IGL_ProgressLabelColor)
NewProgress.Color=IGL_Color.Create(255,255,255)
NewProgress.Blend=ALPHABLEND


Next :

Local Tmp_Value:Int=(Value*Tx)/Maximum
=>> Image_ProgressBar.width = Tx-2-Tmp_Value
Label.SetCaption(Caption+" "+Int((101*(Value))/Maximum)+"%") IGL_DrawImage(Image_ProgressBar,Progress_Px+1+Tmp_Value,Progress_Py+1,Color,0,Blend)

It is correct ?

So many thanks for this fix :)


siread(Posted 2006) [#5]
Not quite. Here are the two fuctions in full:

' ----------------------------
	' Function : Create a Progress
	' ----------------------------
	Function Create:IGL_Progress(parent:Object,Caption:String,Px:Int,Py:Int,Tx:Int,Ty:Int,Value:Int=50,Maximum:Int=100)
		Local NewProgress:IGL_Progress
		
		NewProgress=New IGL_Progress
		
		NewProgress.id=NewProgress
		
		If parent<>Null Then
			NewProgress.parent=parent
		Else
			NewProgress.parent=IGL_MasterWindow
		EndIf
		
		NewProgress.Caption=Caption
				
		NewProgress.Px=Px
		NewProgress.Py=Py	

		NewProgress.Tx=Tx
		NewProgress.Ty=Ty	

		NewProgress.Value=Value
		NewProgress.Maximum=Maximum

		NewProgress.label=IGL_Label.Create(NewProgress.id,NewProgress.Caption,Tx/2,(Ty/2)-(IGL_FontHeight/2),2,IGL_ProgressLabelColor)
		NewProgress.Color=IGL_Color.Create(255,255,255)
		NewProgress.Blend=ALPHABLEND

		NewProgress.Image_ProgressBody=IGL_LoadBorderImage(IGL_Progress_Body,Tx,Ty,IGL_Color.ARGB(IGL_ProgressBorderLightColor),IGL_Color.ARGB(IGL_ProgressBorderDarkColor),2)
		Local Tmp_Value:Int=(Value*Tx)/Maximum
		NewProgress.Image_ProgressBar=IGL_LoadBorderImage(IGL_Progress_Bar,Tx-2-Tmp_Value,Ty-2,Null,Null,0)
				
 		IGL_AddParent(NewProgress.parent,NewProgress.id)

		Return NewProgress	
	End Function
	
	' ---------------------------
	' Method : Refresh a Progress
	' ---------------------------
	Method Refresh(WidGetID:IGL_Widget)	
		Local Progress_Px:Int=WidGetID.ChildPx+px
		Local Progress_Py:Int=WidGetID.ChildPy+py
		
		If Hide=False					
			' -----------------------------
			' Test if the gadget is disable
			' -----------------------------		
			If Disable=True Then
				SetAlpha alpha/2
			Else
				SetAlpha alpha
			EndIf
			
			IGL_DrawImage(Image_ProgressBody,Progress_Px,Progress_Py,Color,0,Blend)

			SetViewport Progress_Px+1,Progress_Py,Tx-2,Ty
			
			Local Tmp_Value:Int=(Value*Tx)/Maximum
			
			label.SetCaption(Caption+" "+Int((101*(Value))/Maximum)+"%")
			
			Image_ProgressBar.width = Tx-2-Tmp_Value
			IGL_DrawImage(Image_ProgressBar,Progress_Px+1+Tmp_Value,Progress_Py+1,Color,0,Blend)
		EndIf
		
		' -----------------------
		' Search the widget child
		' -----------------------
		ChildPx=Progress_px
		ChildPy=Progress_Py

		IGL_RefreshChild(ChildList,Self)
		IGL_HideChild(ChildList,Hide)	
		IGL_DisableChild(ChildList,Disable)
		IGL_AlphaChild(ChildList,alpha)

		' ------------------
		' Reset the viewport
		' ------------------
		IGL_ResetGraphic()
	End Method



siread(Posted 2006) [#6]
GAH! I've just discovered that Combo boxes don't scroll. So if you're list of items is too long it goes off the bottom of the screen and there is no way of selecting items at the end of the list. This is a major problem for me as I have huge lists i need to use. HELP!


Filax(Posted 2006) [#7]
Arg !!, i have not solution for this problem for the moment :/
maybe use listbox ?


siread(Posted 2006) [#8]
Yes, that's what i've done. :)

Although that led me to another problem... Listboxes automatically have a horizontal scrollbar which when scrolled to the right makes the text go left. The text still appears outside of the box on the left side. I'm not sure why the scrollbar should scroll at all when the text of each line fits inside the window.

I don't really need a horizontal scrollbar so i just commented the relevant text out of "Inc_Scrollbar.bmx". It would be nicer though to have a parameter that lets you show or hide the scrollbar. :D


Filax(Posted 2006) [#9]
Ok i made this for the next release :)