Drag window with no border

Just starting out? Need help? Post your questions and find answers here.
Rebe
User
User
Posts: 73
Joined: Sun Jul 25, 2004 5:45 am

Drag window with no border

Post by Rebe »

I'm making this little tool and just started on the window and was thinking maybe doing no border .
I have that but would like to be able to drag it .not sure how to add the code as I keep getting errors when I add the code .

Code: Select all

; PureBasic Visual Designer v3.80 build 1249


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Gadget_0
  #Gadget_1
  #Gadget_2
  #Gadget_3
  #Gadget_4
  #Gadget_5
  #Gadget_6
  #Gadget_8
EndEnumeration

;- Image Plugins
UseJPEGImageDecoder()

;- Image Globals
;Global Image0

;- Catch Images
;Image0 = CatchImage(0, ?Image0)

;- Images
DataSection
Image0:
  IncludeBinary "run-it.jpg"
EndDataSection

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 230, 107, 411, 107,  #PB_Window_BorderLess, "...")
     
      If CreateGadgetList(WindowID())
      ComboBoxGadget(#Gadget_0, 10, 10, 240, 20)
      ;ReadFile(#File, tray-app.dat$) 
      ButtonGadget(#Gadget_1, 260, 10, 65, 20, "Go")
      ButtonGadget(#Gadget_2, 340, 10, 65, 20, "Edit")
      ButtonGadget(#Gadget_3, 260, 40, 65, 20, "Add")
      ButtonGadget(#Gadget_4, 340, 40, 65, 20, "Start at boot")
      ButtonGadget(#Gadget_5, 260, 70, 65, 20, "Donate")
      ButtonGadget(#Gadget_6, 340, 70, 65, 20, "Stop boot")
      ImageGadget(#Gadget_8, 10, 40, 250, 50, "runit.jpg")
     
    EndIf
  EndIf
EndProcedure

Open_Window_0()

Repeat
EventID.l = WaitWindowEvent()
   
   If EventID = #PB_Event_CloseWindow 
      Quit = 1
    EndIf

  Until Quit = 1
 
End
Someone could help me with this I would be most greatfull
Fixed typo .
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Post by einander »

Add this lines to your main loop:

Code: Select all

 
if eventid= #WM_LBUTTONDOWN
        SendMessage_(WindowID(),#WM_NCLBUTTONDOWN, #HTCAPTION,0)
Hope this helps.
User avatar
J. Baker
Addict
Addict
Posts: 2182
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Everything needed for a borderless window except maximize.

viewtopic.php?t=12134
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Rebe
User
User
Posts: 73
Joined: Sun Jul 25, 2004 5:45 am

Post by Rebe »

Umm what would be the main loop . I add it and get errors .
---------------------------
PureBasic
---------------------------
Line 71: Unfinished condition
Or
---------------------------
PureBasic
---------------------------
Line 39: A Procedure can't be declared inside an If, Repeat, While or For.

ugh
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post by dontmailme »

This is what you need....

Code: Select all

; PureBasic Visual Designer v3.80 build 1249


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Gadget_0
  #Gadget_1
  #Gadget_2
  #Gadget_3
  #Gadget_4
  #Gadget_5
  #Gadget_6
  #Gadget_8
EndEnumeration

;- Image Plugins
UseJPEGImageDecoder()

;- Image Globals
;Global Image0

;- Catch Images
;Image0 = CatchImage(0, ?Image0)

;- Images
DataSection
Image0:
IncludeBinary "pb.bmp"
EndDataSection

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 230, 107, 411, 107,  #PB_Window_BorderLess, "...")
    
    If CreateGadgetList(WindowID())
      ComboBoxGadget(#Gadget_0, 10, 10, 240, 20)
      ;ReadFile(#File, tray-app.dat$)
      ButtonGadget(#Gadget_1, 260, 10, 65, 20, "Go")
      ButtonGadget(#Gadget_2, 340, 10, 65, 20, "Edit")
      ButtonGadget(#Gadget_3, 260, 40, 65, 20, "Add")
      ButtonGadget(#Gadget_4, 340, 40, 65, 20, "Start at boot")
      ButtonGadget(#Gadget_5, 260, 70, 65, 20, "Donate")
      ButtonGadget(#Gadget_6, 340, 70, 65, 20, "Stop boot")
      ImageGadget(#Gadget_8, 10, 40, 250, 50, "runit.jpg")
      
    EndIf
  EndIf
EndProcedure

Open_Window_0()

Repeat
  eventID.l = WaitWindowEvent()
  
  If eventID = #PB_Event_CloseWindow
    quit = 1
  EndIf
  If eventID= #WM_LBUTTONDOWN
    SendMessage_(WindowID(),#WM_NCLBUTTONDOWN, #HTCAPTION,0)
  EndIf
Until quit = 1

End
:)
Paid up PB User !
Rebe
User
User
Posts: 73
Joined: Sun Jul 25, 2004 5:45 am

Post by Rebe »

thank you that did the trick .
Post Reply