[bb] Win 3.11 style window by Nebula [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : Win 3.11 style window
Author : Nebula
Posted : 1+ years ago

Description : Empty Windows 3.11 style window with minimize close and titlebar movement and no resizing.

One function call deals with the window.


Code :
Code (blitzbasic) Select
Global mywin
Global wintitle$ = "My window"
Global winx = 100
Global winy = 100
Global winwidth = 320
Global winheight = 200
Global myox,myoy
Global buttonmin
Global buttonclose
Global mytbar
Global mylock

makemywin
While myExit = False
we = WaitEvent()
mywin we
Wend
End

Function makemywin()
mywin = CreateWindow (wintitle$ ,winx,winy,winwidth,winheight,Desktop(),0)
buttonmin   = CreateButton("--" ,GadgetWidth(mywin)-64,+1,32,16-2,mywin)
buttonclose = CreateButton("X" ,GadgetWidth(mywin)-32,+1,32,16-2,mywin)
mytbar = CreateCanvas( 0,0,GadgetWidth(mywin),16,mywin)
SetBuffer CanvasBuffer(mytbar)
ClsColor 0,0,200
Cls
Color 255,255,255
Text 10,2,wintitle$
FlipCanvas mytbar
End Function

Function mywin(action)
Select action
Case $401 ; button
If EventSource() = buttonmin Then MinimizeWindow(mywin)
If EventSource() = buttonclose Then End
Case $201 ; mousedown
If EventSource() = mytbar
mylock = True
myox = EventX()
myoy = EventY()
End If
Case $202 ; mouseup
If EventSource() = mytbar
mylock = False
End If
Case $203 ; mousemove
If EventSource() = mytbar
If mylock = True Then
SetGadgetShape mywin,MouseX()-myox,MouseY()-myoy,ClientWidth(mywin),ClientHeight(mywin)
End If
End If
Case $206;mouseleave
If EventSource() = mytbar
mylock=False
End If
End Select
End Function


Comments :


Zeachco(Posted 1+ years ago)

 Nice little tips to make a customed window interface ;)thx


bytecode77(Posted 1+ years ago)

 but not very nice to post in a 1 year old thread...


Yan(Posted 1+ years ago)

 ...But perfectly acceptable in the code archives...


Ked(Posted 1+ years ago)

 Agreed.