New version of the screen gadget lib

Developed or developing a new product in PureBasic? Tell the world about it.
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

New version of the screen gadget lib

Post 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.
User avatar
loadstone
User
User
Posts: 97
Joined: Wed Jan 16, 2008 11:28 am
Location: china

Post by loadstone »

thanks~~@_@
jamirokwai
Enthusiast
Enthusiast
Posts: 798
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: New version of the screen gadget lib

Post 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.
Regards,
JamiroKwai
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post 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?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

What is the advantage of a window manager that can't leave the window? Maybe for games.
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post 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?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post 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:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

@Psychophanta
Thx

I uploaded the File again, now with the resident file.
Hope that it will work now
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Yes, it works. Many thanks!
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Fig
Enthusiast
Enthusiast
Posts: 352
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

Re: New version of the screen gadget lib

Post by Fig »

very usefull job !!
Does anyone else use that kind of program for full screen and would like to share ?
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re:

Post 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?
User avatar
STARGÅTE
Addict
Addict
Posts: 2234
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: New version of the screen gadget lib

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply