Window With Border Without Caption
- Michael Vogel
- Addict

- Posts: 2819
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Window With Border Without Caption
Rashad, thanks a lot, works perfect now 
Re: Window With Border Without Caption
Now without API and moving window
Update
- Bugfix moving

Update
- Bugfix moving
Code: Select all
;-TOP by mk-soft ;)
Procedure MovingWindowCB()
Static winpos_x, pos_x, delta_x
Static winpos_y, pos_y, delta_y
Static move
Select EventType()
Case #PB_EventType_LeftButtonDown
winpos_x = WindowX(0)
winpos_y = WindowY(0)
pos_x = DesktopMouseX()
pos_y = DesktopMouseY()
move = #True
Case #PB_EventType_LeftButtonUp
move = #False
Case #PB_EventType_MouseMove
If move
delta_x = pos_x - DesktopMouseX()
delta_y = pos_y - DesktopMouseY()
ResizeWindow(0, winpos_x - delta_x, winpos_y - delta_y, #PB_Ignore, #PB_Ignore)
EndIf
EndSelect
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "ContainerGadget", #PB_Window_ScreenCentered | #PB_Window_BorderLess)
SetWindowColor(0, $00008B)
CanvasGadget(0, 4, 4, WindowWidth(0) - 8, WindowHeight(0) - 8, #PB_Canvas_Border | #PB_Canvas_Container)
ButtonGadget(1, GadgetWidth(0) - 36, 0, 32, 32, "X")
ButtonGadget(2, 10, 15, 80, 24, "Button 1")
ButtonGadget(3, 95, 15, 80, 24, "Button 2")
CloseGadgetList()
BindGadgetEvent(0, @MovingWindowCB(), #PB_All)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Break
EndSelect
EndSelect
ForEver
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
- Mindphazer
- Enthusiast

- Posts: 486
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Window With Border Without Caption
Hello mk-soft
I've been using your code in one of my apps
Since PB 6.21, something has changed. When there is a textgadget inside the CanvasGadget, clicking inside the textgadget to move the window doesn't work anymore. You have to click outside the textgadget.
Try this code with PB 6.20 and PB 6.21 to see the difference :
I've been using your code in one of my apps
Since PB 6.21, something has changed. When there is a textgadget inside the CanvasGadget, clicking inside the textgadget to move the window doesn't work anymore. You have to click outside the textgadget.
Try this code with PB 6.20 and PB 6.21 to see the difference :
Code: Select all
;-TOP by mk-soft ;)
Procedure MovingWindowCB()
Static winpos_x, pos_x, delta_x
Static winpos_y, pos_y, delta_y
Static move
Select EventType()
Case #PB_EventType_LeftButtonDown
winpos_x = WindowX(0)
winpos_y = WindowY(0)
pos_x = DesktopMouseX()
pos_y = DesktopMouseY()
move = #True
Case #PB_EventType_LeftButtonUp
move = #False
Case #PB_EventType_MouseMove
If move
delta_x = pos_x - DesktopMouseX()
delta_y = pos_y - DesktopMouseY()
ResizeWindow(0, winpos_x - delta_x, winpos_y - delta_y, #PB_Ignore, #PB_Ignore)
EndIf
EndSelect
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "ContainerGadget", #PB_Window_ScreenCentered | #PB_Window_BorderLess)
SetWindowColor(0, $00008B)
CanvasGadget(0, 4, 4, WindowWidth(0) - 8, WindowHeight(0) - 8, #PB_Canvas_Border | #PB_Canvas_Container)
ButtonGadget(1, GadgetWidth(0) - 36, 0, 32, 32, "X")
ButtonGadget(2, 10, 15, 80, 24, "Button 1")
ButtonGadget(3, 95, 15, 80, 24, "Button 2")
TextGadget(4, 10, 150, GadgetWidth(0) - 20, 200, "Test")
CloseGadgetList()
BindGadgetEvent(0, @MovingWindowCB(), #PB_All)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Break
EndSelect
EndSelect
ForEver
EndIf
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Window With Border Without Caption
Something has changed in the CanvasGadget.
Probably that there are no duplicate events from TextGadget and CanvasGadget.
Probably had a reason...
Probably that there are no duplicate events from TextGadget and CanvasGadget.
Probably had a reason...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
- Mindphazer
- Enthusiast

- Posts: 486
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Window With Border Without Caption
Yes, i'm not sure it can be called a "bug"
But it was very useful in my application.. So i have to compile with 6.20
And there's the same bahaviour in PB6.30
But it was very useful in my application.. So i have to compile with 6.20
And there's the same bahaviour in PB6.30
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Window With Border Without Caption
For Windows it's easy using API
For MAC Maybe
The code not supporting DPI
For MAC Maybe
The code not supporting DPI
Code: Select all
Procedure MovingWindowCB()
DisableGadget(4,1)
Static winpos_x, pos_x, delta_x
Static winpos_y, pos_y, delta_y
Static move
Select EventType()
Case #PB_EventType_LeftButtonDown
winpos_x = WindowX(0)
winpos_y = WindowY(0)
pos_x = DesktopMouseX()
pos_y = DesktopMouseY()
move = #True
Case #PB_EventType_LeftButtonUp
move = #False
DisableGadget(4,0)
Case #PB_EventType_MouseMove
If move
delta_x = pos_x - DesktopMouseX()
delta_y = pos_y - DesktopMouseY()
ResizeWindow(0, winpos_x - delta_x, winpos_y - delta_y, #PB_Ignore, #PB_Ignore)
EndIf
EndSelect
EndProcedure
Egypt my love
- Mindphazer
- Enthusiast

- Posts: 486
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Window With Border Without Caption
Thanks Rashad, it works, but the TextGadget stays disabled, whatever you do
By the way, this problem doesn't occur on MacOS, even with PB6.21. So it seems related to CanvasGadget on Windows
By the way, this problem doesn't occur on MacOS, even with PB6.21. So it seems related to CanvasGadget on Windows
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Window With Border Without Caption
Hi Mindphazer
I thought that you are asking for MAC
Like I said it's easy for WINDOWS
I thought that you are asking for MAC
Like I said it's easy for WINDOWS
Code: Select all
;-TOP by mk-soft ;)
Procedure MovingWindowCB()
Static winpos_x, pos_x, delta_x
Static winpos_y, pos_y, delta_y
Static move
Select EventType()
Case #PB_EventType_LeftButtonDown
winpos_x = WindowX(0)
winpos_y = WindowY(0)
pos_x = DesktopMouseX()
pos_y = DesktopMouseY()
move = #True
Case #PB_EventType_LeftButtonUp
move = #False
Case #PB_EventType_MouseMove
If move
delta_x = pos_x - DesktopMouseX()
delta_y = pos_y - DesktopMouseY()
ResizeWindow(0, winpos_x - delta_x, winpos_y - delta_y, #PB_Ignore, #PB_Ignore)
EndIf
EndSelect
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "ContainerGadget", #PB_Window_ScreenCentered | #PB_Window_BorderLess)
SetWindowColor(0, $00008B)
CanvasGadget(0, 4, 4, WindowWidth(0) - 8, WindowHeight(0) - 8, #PB_Canvas_Border | #PB_Canvas_Container)
ButtonGadget(1, GadgetWidth(0) - 36, 0, 32, 32, "X")
ButtonGadget(2, 10, 15, 80, 24, "Button 1")
ButtonGadget(3, 95, 15, 80, 24, "Button 2")
TextGadget(4, 10, 150, GadgetWidth(0) - 20, 200, "Test")
SetWindowLongPtr_(GadgetID(4),#GWL_STYLE ,GetWindowLongPtr_(GadgetID(4),#GWL_STYLE)&~ #SS_NOTIFY)
CloseGadgetList()
SetGadgetText(4," Hi Mindphazer")
SetGadgetColor(4,#PB_Gadget_BackColor,0)
SetGadgetColor(4,#PB_Gadget_FrontColor,$FFFFFF)
BindGadgetEvent(0, @MovingWindowCB(), #PB_All)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Break
EndSelect
EndSelect
ForEver
EndIf
Egypt my love
- Mindphazer
- Enthusiast

- Posts: 486
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Window With Border Without Caption
It works fine, thanks a lot
(Yeah, i'm using a Mac at home, but here it was for my work, on Windows
)
(Yeah, i'm using a Mac at home, but here it was for my work, on Windows
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...

