Page 1 of 1

New version of the screen gadget lib

Posted: Fri Nov 14, 2008 4:04 pm
by Hurga
I needed some requester on a screen so I decided to add some window-functionality to my screen gadget lib.

These functions are new:

Code: Select all

SG_OpenWindow(SG_WindowID_L.l, xPos_L.l, yPos_L.l, Width_L.l, Height_L.l, Title_S.s)
SG_CloseWindow(WindowNr_L.l)
SG_HideWindow(WindowNr_L.l, State_L.l)
SG_DisableWindow(WindowNr_L.l, Status_L.l)
SG_CreateGadgetList(SG_WindowID_L.l)
SG_SetActiveWindow(WindowNr_L.l) ; sets the currently active window
SG_IsWindow(SG_WindowID_L.l) ; returns 0, if the window does not exist, else a value <> 0 (= Window ID)
SG_GetWindowBackGround(WindowNr_L.l) ; returns the background of the window   - 0 = no Background   1= Color  2 = image
SG_GetWindowBackgroundDetail(WindowNr_L.l) ; returns the Backround - Value (Color or imageID)
SG_SetWindowBackGround(WindowNr_L.l, State_L.l); change the background of the window   - 0 = no Background   1= Color  2 = image
SG_SetWindowBackgroundDetail(WindowNr_L.l, Value_L.l) ; sets the ImageID of the background of the window
SG_SetWindowState(WindowNr_L.l, Status_L.l) 
SG_SetWindowTitle(WindowNr_L.l, Title_S.s)
SG_ResizeWindow(WindowNr_L.l, xPos_L.l, yPos_L.l, Width_L.l, Height_L.l) ; set the window to a new position and and size
SG_StickyWindow(WindowNr_L.l, Status_L.l)
SG_WindowID(WindowNr_L.l)
SG_WindowHeight(WindowNr_L.l) 
SG_WindowWidth(WindowNr_L.l)
SG_WindowMouseX(WindowNr_L.l)
SG_WindowMouseY(WindowNr_L.l)
SG_WindowX(WindowNr_L.l)
SG_WindowY(WindowNr_L.l)
SG_GetActiveWindow() ; return the currently active window
SG_GetWindowState(WindowNr_L.l) 
Here is a little demo of the windows with some gadgets
Image


and here you can find the source code and the compiled demo (87k zipped)
http://purebasic.stdojedmahr.de/projekt ... etDemo.zip

The source is written for PB 4.2

If someone is using Linux, maybe (s)he can test the code under linux, if it runs. (I hope so, but have no change of testing it). Same with Mac.

I have use a rather old PC, so the fps (upper left corner) are more or less low. Can someone post his configuration and fps?

I got 52 fps with the demo.

If someone found any bugs, please report.

Posted: Sat Nov 15, 2008 7:13 pm
by loadstone
thanks~~@_@

Re: New version of the screen gadget lib

Posted: Sun Nov 16, 2008 12:14 am
by jamirokwai
Hi,

tested on Mac Intel PB 4.30b4. Following problems occured:

558 - constant not found #SG_BackgroundColor
730 - constant not found #SG_BackgroundImage
4381 - constant not found #SG_ListIcon_ChangeColumnWidth
5745 - constants not found #PB_FileSystem_ReadOnly and such
59xx - constant not founds #SG_BackgroundTransparent and such, following four lines
76xx - constants not found #SG_BackgroundTransparent and such

(xx occured because I removed some lines of code, as I thought the problem with
the constants would not occure again :))

Keyword EXTRN does not work. Put $0 into every missing constant, removed EXTRN from

Procedure.l ScreenWidth()
!EXTRN _PB_Screen_Width
!MOV Eax, [_PB_Screen_Width]
ProcedureReturn
EndProcedure
Procedure.l ScreenHeight()
!EXTRN _PB_Screen_Height
!MOV Eax, [_PB_Screen_Height]
ProcedureReturn
EndProcedure

Crashes a few seconds after start.

Best Regards,
JamiroKwai

Hurga wrote:I needed some requester on a screen so I decided to add some window-functionality to my screen gadget lib.

These functions are new:

Code: Select all

SG_OpenWindow(SG_WindowID_L.l, xPos_L.l, yPos_L.l, Width_L.l, Height_L.l, Title_S.s)
SG_CloseWindow(WindowNr_L.l)
SG_HideWindow(WindowNr_L.l, State_L.l)
SG_DisableWindow(WindowNr_L.l, Status_L.l)
SG_CreateGadgetList(SG_WindowID_L.l)
SG_SetActiveWindow(WindowNr_L.l) ; sets the currently active window
SG_IsWindow(SG_WindowID_L.l) ; returns 0, if the window does not exist, else a value <> 0 (= Window ID)
SG_GetWindowBackGround(WindowNr_L.l) ; returns the background of the window   - 0 = no Background   1= Color  2 = image
SG_GetWindowBackgroundDetail(WindowNr_L.l) ; returns the Backround - Value (Color or imageID)
SG_SetWindowBackGround(WindowNr_L.l, State_L.l); change the background of the window   - 0 = no Background   1= Color  2 = image
SG_SetWindowBackgroundDetail(WindowNr_L.l, Value_L.l) ; sets the ImageID of the background of the window
SG_SetWindowState(WindowNr_L.l, Status_L.l) 
SG_SetWindowTitle(WindowNr_L.l, Title_S.s)
SG_ResizeWindow(WindowNr_L.l, xPos_L.l, yPos_L.l, Width_L.l, Height_L.l) ; set the window to a new position and and size
SG_StickyWindow(WindowNr_L.l, Status_L.l)
SG_WindowID(WindowNr_L.l)
SG_WindowHeight(WindowNr_L.l) 
SG_WindowWidth(WindowNr_L.l)
SG_WindowMouseX(WindowNr_L.l)
SG_WindowMouseY(WindowNr_L.l)
SG_WindowX(WindowNr_L.l)
SG_WindowY(WindowNr_L.l)
SG_GetActiveWindow() ; return the currently active window
SG_GetWindowState(WindowNr_L.l) 
Here is a little demo of the windows with some gadgets
Image


and here you can find the source code and the compiled demo (87k zipped)
http://purebasic.stdojedmahr.de/projekt ... etDemo.zip

The source is written for PB 4.2

If someone is using Linux, maybe (s)he can test the code under linux, if it runs. (I hope so, but have no change of testing it). Same with Mac.

I have use a rather old PC, so the fps (upper left corner) are more or less low. Can someone post his configuration and fps?

I got 52 fps with the demo.

If someone found any bugs, please report.

Posted: Sun Nov 16, 2008 10:24 am
by Hurga
Thx jamirokwai for testing it on mac.

The constants was my fault. I forgot the redident-file. I will add it on monday.

But I dont have any idea why "Extern" does not work? Is a "feature" with PB - Mac?

Posted: Sun Nov 16, 2008 11:51 am
by Mistrel
What is the advantage of a window manager that can't leave the window? Maybe for games.

Posted: Mon Nov 17, 2008 9:10 am
by Hurga
What is the advantage of a window manager that can't leave the window? Maybe for games.
Sorry, I didnt understand what you mean. Can you explain a bit more?

Posted: Mon Nov 17, 2008 1:35 pm
by Psychophanta
Mistrel wrote:What is the advantage of a window manager that can't leave the window? Maybe for games.
I would say not exactly for games, but for editors, filerequesters without having to close full screen, and in general any windows-like management needed some times in permanent fullscreens.

It is useful to me, thanks!
Waiting for those constants :wink:

Posted: Tue Nov 18, 2008 7:54 am
by Hurga
@Psychophanta
Thx

I uploaded the File again, now with the resident file.
Hope that it will work now

Posted: Tue Nov 18, 2008 1:49 pm
by Psychophanta
Yes, it works. Many thanks!

Re: New version of the screen gadget lib

Posted: Wed Mar 28, 2012 8:01 pm
by Fig
very usefull job !!
Does anyone else use that kind of program for full screen and would like to share ?

Re:

Posted: Thu Mar 29, 2012 4:32 pm
by Zach
Psychophanta wrote:
Mistrel wrote:What is the advantage of a window manager that can't leave the window? Maybe for games.
I would say not exactly for games, but for editors, filerequesters without having to close full screen, and in general any windows-like management needed some times in permanent fullscreens.

It is useful to me, thanks!
Waiting for those constants :wink:
When I watch video files in MPC in full-screen I can load a click-menu / file requester that looks like standard Winforms stuff without leaving fullscreen?

Is that a fake fullscreen or something?

Re: New version of the screen gadget lib

Posted: Thu Mar 29, 2012 6:50 pm
by STARGĂ…TE
yes.
WindowedScreen with maximizes and borderless window:

Code: Select all

InitSprite()

Enumeration
	#Window
	#MenuItem
	#MenuItem2
EndEnumeration

ExamineDesktops()
OpenWindow(#Window, 0, 0, DesktopWidth(0), DesktopHeight(0), "ScreenTitle", #PB_Window_BorderLess|#PB_Window_Maximize)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)

AddKeyboardShortcut(#Window, #PB_Shortcut_Escape, #MenuItem)

Repeat
	
	Repeat
		
		Select WindowEvent()
			Case #PB_Event_CloseWindow
				End
			Case #PB_Event_Menu
				Select EventMenu()
					Case #MenuItem
						End
				EndSelect
			Case #Null
				Break
		EndSelect
		
	ForEver
	
	ClearScreen(0)
	
	FlipBuffers()
	
ForEver