Ooops
November 28, 2020, 01:50:32 PM

Author Topic: [bb] Win 3.11 style window by Nebula [ 1+ years ago ]  (Read 536 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Win 3.11 style window by Nebula [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
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
  1. Global mywin
  2. Global wintitle$        = "My window"
  3. Global winx                     = 100
  4. Global winy                     = 100
  5. Global winwidth         = 320
  6. Global winheight        = 200
  7. Global myox,myoy
  8. Global buttonmin
  9. Global buttonclose
  10. Global mytbar
  11. Global mylock
  12.  
  13. makemywin
  14. While myExit = False
  15.         we = WaitEvent()
  16.         mywin we
  17. Wend
  18. End
  19.  
  20. Function makemywin()
  21.         mywin           = CreateWindow  (wintitle$      ,winx,winy,winwidth,winheight,Desktop(),0)
  22.         buttonmin       =       CreateButton("--"               ,GadgetWidth(mywin)-64,+1,32,16-2,mywin)
  23.         buttonclose =   CreateButton("X"                ,GadgetWidth(mywin)-32,+1,32,16-2,mywin)
  24.         mytbar          =       CreateCanvas(                   0,0,GadgetWidth(mywin),16,mywin)       
  25.         SetBuffer CanvasBuffer(mytbar)
  26.         ClsColor 0,0,200
  27.         Cls
  28.         Color 255,255,255
  29.         Text 10,2,wintitle$
  30.         FlipCanvas mytbar      
  31. End Function
  32.  
  33. Function mywin(action)
  34.         Select action
  35.                 Case $401 ; button
  36.                         If EventSource() = buttonmin Then MinimizeWindow(mywin)
  37.                         If EventSource() = buttonclose Then End
  38.                 Case $201 ; mousedown
  39.                         If EventSource() = mytbar
  40.                                 mylock = True
  41.                                 myox = EventX()
  42.                                 myoy = EventY()
  43.                         End If
  44.                 Case $202 ; mouseup
  45.                         If EventSource() = mytbar
  46.                                 mylock = False
  47.                         End If
  48.                 Case $203 ; mousemove
  49.                         If EventSource() = mytbar
  50.                                 If mylock = True Then
  51.                                         SetGadgetShape mywin,MouseX()-myox,MouseY()-myoy,ClientWidth(mywin),ClientHeight(mywin)
  52.                                 End If
  53.                         End If
  54.                 Case $206;mouseleave
  55.                         If EventSource() = mytbar
  56.                                 mylock=False
  57.                         End If
  58.         End Select
  59. 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.


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal