View previous topic :: View next topic |
Author |
Message |
bbelcher Contributor
Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Aug 13, 2004 2:58 pm Post subject: Anchor dialog to another window |
|
|
What I'm trying to do is make an invisible dialog with just a button showing then anchors it to the title bar of a different window. When I set the dialog to be on top of the target window it seams to work fine but if a different window is moved over the target window then the invisible button shows on that window and the target is hidden below.
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Aug 13, 2004 3:48 pm Post subject: |
|
|
Are you trying to create a button on a window title bar? I believe that
Tommy made some code once to do that. I'll see if I can find it. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
bbelcher Contributor
Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Aug 13, 2004 3:54 pm Post subject: |
|
|
yep |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Aug 13, 2004 4:01 pm Post subject: |
|
|
Does this do what you want, or should the button also be shown when the window is not active?
Code: | DIALOG CREATE,Nieuw Dialoog,-1,0,240,160,NOTITLE,INVISIBLE,ONTOP
REM *** Gewijzigd door de Dialoog Ontwerper op 13-8-2004 - 17:58 ***
DIALOG ADD,BUTTON,BUTTON1,0,0,90,25,Clickclick...
:Evloop
wait event,0.0001
goto @event()
:Timer
%%Window = Naamloos - Kladblok
if @equal(@winactive(),%%Window)@equal(@winactive(),@dlgtext())
dialog setpos,,@winpos(%%Window,T),@winpos(%%Window,L)
dialog show
else
dialog hide
end
goto Evloop
:Button1button
info You clicked me!
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Aug 13, 2004 4:11 pm Post subject: |
|
|
Here's Tommy's code (from the archives):
Quote: | The following script adds an additional button on any active title bar. As this is just an example, the script simply exits after a button press. The disadvantages of such a button, compared with a true button, are that you need to click using the middle mouse button (if you change it to use the left mouse button, the window would be dragged while pressing the button) and that the script is unable to determine the window kind (eg. notitle). Currently the script doesn't read custom color settings from the registry.
Code: | option decimalsep,.
directory change,@path(%0)
external vdsimage.dll
external vdsdll.dll,Public Freeware Key|90257236
dialog create,Dummy
%%buttonwidth = 16
%%buttonheight = 14
repeat
if @not(@equal(@winactive(C),Shell_TrayWnd))
%%winid = @winactive(I)
%%buttontop = 6
%%buttonleft = @diff(@winpos(%%winid,W),75)
gosub drawup
%%desttop = @sum(@winpos(%%winid,T),%%buttontop)
%%destleft = @sum(@winpos(%%winid,L),%%buttonleft)
%%destwidth = %%buttonwidth
%%destheight = %%buttonheight
gosub mouseover
if @dll(keyboard,mbutton)
if %%mouseover
gosub drawdown
repeat
wait 0.1
gosub mouseover
if %%mouseover
gosub drawdown
else
gosub drawup
end
until @not(@dll(keyboard,mbutton))
if %%mouseover
rem repaint title bar of last active window
%a = @sendmsg(%%winid,$086,1,0)
stop
end
else
repeat
wait 0.1
until @not(@dll(keyboard,mbutton))
end
end
end
wait 0.1
until @event()
exit
:mouseover
%%mouseover =
%%curtop = @mousepos(y)
%%curleft = @mousepos(x)
%%v1 = @greater(%%curleft,@pred(%%destleft))
%%v2 = @greater(@sum(%%destleft,%Þstwidth),%%curleft)
%%v3 = @greater(%%curtop,@pred(%%desttop))
%%v4 = @greater(@sum(%%desttop,%%destheight),%%curtop)
if @equal(1111,%%v1%%v2%%v3%%v4)
%%mouseover = 1
end
exit
:drawup
image open
image rect,0,0,%%buttonwidth,%%buttonheight,$00404040
image rect,0,0,@pred(%%buttonwidth),@pred(%%buttonheight),white
image rect,1,1,@diff(%%buttonwidth,2),@diff(%%buttonheight,2),$00808080
image rect,1,1,@diff(%%buttonwidth,3),@diff(%%buttonheight,3),$00C8D0D4
image rect,7,7,2,2,black
gosub draw
exit
:drawdown
image open
image rect,0,0,%%buttonwidth,%%buttonheight,white
image rect,0,0,@pred(%%buttonwidth),@pred(%%buttonheight),$00404040
image rect,1,1,@diff(%%buttonwidth,2),@diff(%%buttonheight,2),$00C8D0D4
image rect,1,1,@diff(%%buttonwidth,3),@diff(%%buttonheight,3),$00808080
image rect,2,2,@diff(%%buttonwidth,4),@diff(%%buttonheight,4),$00C8D0D4
image rect,8,8,2,2,black
gosub draw
exit
:draw
image windowdraw,%%winid,%%buttontop,%%buttonleft
exit | --------------------------------------------------------------------------------
Tommy |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
bbelcher Contributor
Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Aug 13, 2004 4:15 pm Post subject: |
|
|
I had about the same code but I didn’t think about using @winactive() that will do the trick.
There must be an API for that because I have a dual monitor system and it puts an icon on all open windows and they seam to be imbedded. That will have to be a future project .
Thanks! |
|
Back to top |
|
|
bbelcher Contributor
Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Aug 13, 2004 4:17 pm Post subject: |
|
|
you must have been reading my post before I posted it.
|
|
Back to top |
|
|
bbelcher Contributor
Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Aug 13, 2004 8:13 pm Post subject: |
|
|
In Tommys 2.8 VDSDLL how do you define the command and function
would it be like the following?
external vdsdll.dll,Public Freeware Key|90257236
#define command,keyboard
#define function,keyboard
rem define global checking
keyboard global,global
%%mouse = @DLL(KEYBOARD,LBUTTON)
Is this right? |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Sat Aug 14, 2004 12:17 am Post subject: |
|
|
No, you should use the following, then all parts of the DLL should function:
#define command,dll
#define function,dll |
|
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
|
|