Page 1 of 1

Drag window with no border

Posted: Wed Oct 06, 2004 9:26 am
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 .

Posted: Wed Oct 06, 2004 10:05 am
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.

Posted: Wed Oct 06, 2004 10:30 am
by J. Baker
Everything needed for a borderless window except maximize.

viewtopic.php?t=12134

Posted: Wed Oct 06, 2004 10:33 am
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

Posted: Wed Oct 06, 2004 11:02 am
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
:)

Posted: Wed Oct 06, 2004 5:15 pm
by Rebe
thank you that did the trick .