Seite 4 von 6

Verfasst: 05.06.2009 19:31
von R4z0r1989
für welche pb version ist es denn geschrieben?

Ich benutz 4.10

Verfasst: 05.06.2009 19:41
von R4z0r1989
ah ok habs doch zum laufen gebracht...
falsche lib... :-/

gibt es ein brauchbares beispiel für die erstellte dll die mir ansatzweiße die funktionsweiße beschreibt bzw. mir einfach einen ansatz geben könnte?

Ich danke im voraus

Verfasst: 05.06.2009 22:05
von HeX0R

Code: Alles auswählen

;Shows a ProgressBar on a G15 (if available)
;If you don't own a G15 keyboard change to #False:
XIncludeFile "G15_Source.pb"

#HAS_G15_KEYBOARD = #True

Structure _G15_STATIC_VARS_
	Device.l
	Connection.l
	ImageID.l
EndStructure

Procedure G15_Show_Progress(Progress, ProgramName.s = "")
	;Progress goes from 0 to 100.
	;If you send -1, Application will close connection to the G15
	Protected ctx.lgLcdConnectContext, ctxo.lgLcdOpenContext
	Protected InitMode

	Static G15._G15_STATIC_VARS_

	If Progress < -1
		Progress = -1
	ElseIf Progress > 100
		Progress = 100
	EndIf
	If G15\Device = 0
		;First Call!
		If #HAS_G15_KEYBOARD
			InitMode = #LGLCD_INIT_NORMAL; | #LGLCD_INIT_ADD_DISPLAY
		Else
			InitMode = #LGLCD_INIT_ONLY_DISPLAY
		EndIf
		If lgLcdInit(InitMode) = #ERROR_SUCCESS
			ctx\appFriendlyName = @ProgramName
			ctx\isPersistent    = #False
			ctx\isAutostartable = #False
			If lgLcdConnect(@ctx) <> #ERROR_SUCCESS
				lgLcdDeInit()
			Else
				ctxo\connection = ctx\connection
				ctxo\index      = 0
				G15\Connection  = ctx\connection
				If lgLcdOpen(@ctxo) <> #ERROR_SUCCESS
					lgLcdDisconnect(G15\Connection)
					lgLcdDeInit()
				Else
					G15\Device  = ctxo\Device
					G15\ImageID = CreateImage(#PB_Any, #LGLCD_BMP_WIDTH, #LGLCD_BMP_HEIGHT, 8) ;<- Only 8Bit supported!
					;Create RawPicture
					StartDrawing(ImageOutput(G15\ImageID))
					FillArea(0, 0, -1, $FFFFFF)
					DrawText((#LGLCD_BMP_WIDTH - TextWidth("Loading " + ProgramName)) / 2, 5, "Loading " + ProgramName, 0)
					Box(20, 30, Progress, 10, 0)
					DrawText(125, 26, Str(Progress) + "%")
					StopDrawing()
					If lgLcdUpdateBitmap(G15\Device,G15\ImageID, LGLCD_ASYNC_UPDATE(#LGLCD_PRIORITY_ALERT)) = #ERROR_SUCCESS
						lgLcdSetAsLCDForegroundApp(G15\Device, #LGLCD_LCD_FOREGROUND_APP_YES)
					EndIf
				EndIf
			EndIf
		EndIf
	ElseIf Progress = -1
		lgLcdClose(G15\Device)
		lgLcdDisconnect(G15\Connection)
		lgLcdDeInit()
		G15\Device = 0
		FreeImage(G15\ImageID)
	ElseIf IsImage(G15\ImageID)
		StartDrawing(ImageOutput(G15\ImageID))
		Box(20, 30, Progress, 10, 0)
		DrawText(125, 26, Str(Progress) + "%")
		StopDrawing()
		lgLcdUpdateBitmap(G15\Device, G15\ImageID, LGLCD_ASYNC_UPDATE(#LGLCD_PRIORITY_ALERT))
	EndIf

EndProcedure


;-------------------------
;Example!!
Procedure main()
	OpenWindow(0, 250, 250, 220, 44, "Progress Test...", #PB_Window_SystemMenu)
	TextGadget(0, 10, 14, 200, 20, "Watch your Display", #PB_Text_Center)

	Repeat
		Select WaitWindowEvent(20)
			Case #PB_Event_CloseWindow
				G15_Show_Progress(-1)
				Break
			Case 0
				If i < 101
					G15_Show_Progress(i, "My Application")
					i + 1
				ElseIf i = 101
					i = 102
					SetGadgetText(0, "Application loaded. Ready to Rumble...")
				EndIf
		EndSelect
	ForEver
EndProcedure

main()


Verfasst: 06.06.2009 00:27
von KeyKon
R4z0r1989 hat geschrieben:Ich benutz 4.10
Warum denn das?

Verfasst: 06.06.2009 10:58
von Andesdaf
R4z0r1989 hat geschrieben:Ich benutz 4.10
Und wieso steht dann der Button in deiner Signatur auf 3.90?

Verfasst: 09.06.2009 13:06
von R4z0r1989
bin mal wieder stecken geblieben und hoffe von euch auf ein beispiel die vier tasten anzusprechen

Verfasst: 09.06.2009 14:24
von HeX0R
Hier steht alles drin.
(Das gleiche hast du auch im SDK)

Verfasst: 09.06.2009 14:53
von R4z0r1989
so habs mir durchgelesen...
werd aber nich schlau draus...

was is device? und *buttons is sicher nen pointer zu ner structure oder?

kleine hilfe braucht der kleine mann


danke im voraus!

Verfasst: 09.06.2009 15:06
von HeX0R
Vielleicht kaut es dir ja noch jemand vor (ich nicht), bis dahin probiers mal hiermit:
Bild

Verfasst: 09.06.2009 18:32
von R4z0r1989
vorkauen musst es mir nicht aber was unter device und was für ein pointer da hin muss wäre ne dufte sache weil ich als return nur immer ne schöne 0 bekomm!