| View previous topic :: View next topic |
| Author |
Message |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 08, 2002 2:14 am Post subject: Fake Title Bar for NOTITLE Window... |
|
|
Here's a fake title bar (with a fake icon). The program
itself is actually a simple text file editor/viewer that
minimizes to the systray. It also has some border trim
to make it look more like a "titled" window.
If you have VDS4, you should use the @mousedown()
function when moving the window, instead of clicking
it to grab/release each time. And if you have XP (or
whatever) you might wanna change the Win95 look...
Check the remarks for more info.
This may or may not be useful, but hopefully it'll give
ya some ideas. Have fun...
__________________________________________________________________________________________________________________________
| Code: |
rem -- NOTITLE window with fake title bar, minimizes to systray.
rem -- Has fake icon, but you can load icons with a BITMAP element.
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Fake Title Bar",-1,0,400,300,NOTITLE
DIALOG ADD,STYLE,Border1,,,,WHITE
DIALOG ADD,STYLE,Border2,,,,$00665555
DIALOG ADD,STYLE,Style0,MS Sans Serif,8,B,DKBLUE,WHITE
DIALOG ADD,STYLE,Style1,Impact,12,B
DIALOG ADD,STYLE,Style2,Wingdings,10
DIALOG ADD,STYLE,Style3,MS Serif,14
DIALOG ADD,STYLE,Style4,MS Sans Serif,8,B,BACKGRND
DIALOG ADD,STYLE,Style5,,,,DKBLUE,WHITE
DIALOG ADD,STYLE,Style6,Wingdings,14,,,CYAN
rem -- Add bottom and right first --
DIALOG ADD,TEXT,Bottom,298,1,398,2,,,Border2
DIALOG ADD,TEXT,Right,1,398,2,298,,,Border2
DIALOG ADD,TEXT,Top,1,1,398,1,,,Border1
DIALOG ADD,TEXT,Left,1,1,1,298,,,Border1
rem -- Add SysBars first --
DIALOG ADD,TEXT,SysBar,4,4,340,18,,,,Style0,CLICK
DIALOG ADD,TEXT,SysBar2,4,340,56,18,,,,Style0
DIALOG ADD,TEXT,SysTitle,6,28,,,"Fake Title Bar - Minimizes to System Tray",,,Style0,CLICK,TRANSPARENT
DIALOG ADD,TEXT,SysIcon,3,6,,,@chr(58),,Style6,CLICK,TRANSPARENT
rem -- Titlebar buttons --
DIALOG ADD,BUTTON,SysMin,6,344,16,14,"-",,Style1
DIALOG ADD,BUTTON,SysMax,6,360,16,14,@chr(114),,Style2
DIALOG DISABLE,SysMax
DIALOG ADD,BUTTON,SysExit,6,378,16,14,@chr(215),,Style3
rem -- Smoke and mirrors "Menu" replacement (no hotkeys) --
DIALOG ADD,TEXT,FileBkGrnd,24,5,25,18," "&File" ",,Style5
DIALOG ADD,TEXT,File,24,5,25,18," "&File" ",,CLICK
DIALOG ADD,EDIT,E1,40,3,393,235,,,MULTI,SCROLL
rem -- Status bar replacement (STATUS element is at top of NOTITLE)--
DIALOG ADD,EDIT,Stat,277,3,393,20,,,READONLY,Style4
DIALOG SHOW
rem -- Dialog status --
%%visible = 1
:EVLOOP
if %%visible
rem -- Move focus from titlebar buttons --
DIALOG FOCUS, E1
DIALOG SET, Stat, "Click title bar to move window..."
end
WAIT EVENT
goto @event()
:SysIconCLICK
DIALOG POPUP,"&Minimize"|-|"&Close Alt+F4"
%e = @event()
if %e
goto %e
end
goto EVLOOP
:SysBarCLICK
:SysTitleCLICK
if @equal(@click(B), "RIGHT")
goto SysIconCLICK
end
%%x1 = @diff(@mousepos(X), @winpos("Fake Title Bar",L))
%%y1 = @diff(@mousepos(Y), @winpos("Fake Title Bar",T))
DIALOG SET, Stat, "Click again to release window..."
REPEAT
%x = @diff(@mousepos(X),%%x1)
%y = @diff(@mousepos(Y),%%y1)
if @greater(0, %x)
%x = 0
end
if @greater(0, %y)
%y = 0
end
WINDOW POSITION,"Fake Title Bar",%y,%x
WAIT ".01"
UNTIL @event()
goto EVLOOP
:MinimizeMENU
:SysMinBUTTON
%%visible = ""
DIALOG ADD,TASKICON,TaskBar,," Fake Title Bar "
DIALOG HIDE
goto EVLOOP
:TaskBarCLICK
%%visible = 1
DIALOG SHOW
DIALOG REMOVE, TaskBar
goto EVLOOP
:FileCLICK
DIALOG HIDE, File
DIALOG POPUP,&New...|&Open...|&Save...|&Save As...|-|&Exit,40,5
%e = @event()
DIALOG SHOW, File
if %e
goto %e
end
goto EVLOOP
:New...MENU
DIALOG CLEAR, E1
goto EVLOOP
:Open...MENU
%f = @filedlg()
if %f
if @greater(@file(%f, Z), 32000)
INFO "File is too large for this program..."@tab()
goto EVLOOP
end
LIST CREATE, 1
LIST LOADFILE, 1, %f
DIALOG SET, E1, @text(1)
LIST CLOSE, 1
end
goto EVLOOP
:Save...MENU
:Save As...MENU
if @dlgtext(E1)
if %f
%f = @filedlg(,,%f,SAVE)
else
%f = @filedlg(,,,SAVE)
end
if %f
LIST CREATE, 1
LIST ASSIGN, 1, @dlgtext(E1)
LIST SAVEFILE, 1, %f
LIST CLOSE, 1
end
else
INFO Nothing to save...@tab()
end
goto EVLOOP
:Close Alt+F4MENU
:ExitMENU
:SysExitBUTTON
:CLOSE
EXIT
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361

Last edited by Mac on Thu Aug 08, 2002 2:47 am; edited 2 times in total |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Aug 08, 2002 2:20 am Post subject: |
|
|
That's a little too real looking
Nice Mac. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 08, 2002 2:26 am Post subject: |
|
|
Thanks Sheep,
I just edited it and shortened the code a little...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Aug 08, 2002 2:33 am Post subject: |
|
|
Just noticed if you click the Maximize button it wants to move the window..is it supposed to? _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 08, 2002 2:41 am Post subject: |
|
|
That's because the maximize button is disabled, and
it clicks the SysBar text element behind it. You could
add another text element to go under the buttons
without the CLICK style.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 08, 2002 2:48 am Post subject: |
|
|
OK, I added another no-click one behind the buttons...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|