AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tips N Tricks
Goto page Previous  1, 2, 3, 4, 5, 6 ... 28, 29, 30  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
PhiLho



Joined: 27 Dec 2005
Posts: 6786
Location: France (near Paris)

PostPosted: Tue May 23, 2006 2:17 pm    Post subject: Reply with quote

You inspired me for an improvement of background color for texts.

@Goyyah: I wasn't clear in my remark on the topic: when I wrote "Where did I saw this text-with-shadow effect?", it is the kind of question I ask myself when I take a quick look at the list of topics in the Scripts & Functions section or even in a Search result! Hence the remark.

@Titan: It seems that Goyyah tried to put something like <img src="Images/2pixelsH.bmp" width="100" height="100" /> in an HTML file and got two distinct colors.
Note that SVG is already supported (perhaps only partially) by Firefox 1.5.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Thalon



Joined: 12 Jul 2005
Posts: 632

PostPosted: Tue May 23, 2006 5:02 pm    Post subject: Reply with quote

Looks nice!
I used a 2x2 Pixel-Bitmap already to draw a flexibel surrounding border (like the highlight-option in Winspector). But this scaling ability is new for me Smile

Thalon
_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Tue May 23, 2006 7:59 pm    Post subject: Reply with quote

Thalon wrote:
Looks nice!
I used a 2x2 Pixel-Bitmap already to draw a flexibel surrounding border (like the highlight-option in Winspector). But this scaling ability is new for me Smile


Thanks Thalon! Very Happy

Dear PhiLho, Smile

You wrote:
an improvement of background color for texts.


I saw it. Very nice effect!

You wrote:
I wasn't clear in my remark on the topic: when I wrote "Where did I saw this text-with-shadow effect?", it is the kind of question I ask myself when I take a quick look at the list of topics in the Scripts & Functions section or even in a Search result! Hence the remark.


I get it now! Smile.

Please wait for the Part 2. I will be requiring your valuable opinion.

Regards, Smile
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Tue May 23, 2006 8:13 pm    Post subject: Reply with quote

Quote:
The following post has been updated:

How to Simulate a Linear Gradient ? - Part 1
http://www.autohotkey.com/forum/viewtopic.php?p=61081#61081

--> An example for Horizontal Linear Gradient
  • OSD Volume Control (Added 24-May-2006)

_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Wed May 24, 2006 9:56 am    Post subject: Reply with quote

Dear PhiLho, Smile

In your Post

You wrote:
[EDIT] I wrote non-sense!
Note that if you use AltSubmit, you won't have gradient, so this trick works mostly with [b]BMP images (not a problem as these images are very small)!


Yes! I just noticed Shocked. I was not interested in JPG - because for this particular resolution (1x2) , BMP was sized @ 62 byes whereas JPG was 512 bytes. Also the file format of BMP is very simple and we could easily create one dynamically.

Regards, Smile
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
rbt137
Guest





PostPosted: Wed May 24, 2006 5:19 pm    Post subject: clock/timer/replace start button Reply with quote

This is awesome!

I have looked for a countdown timer, seemingly forever. I have even thought of making it myself. Thankfully, you have done it for me.

Now I'm scared that microsoft will hire you and creative stuff like this will be forever gone.

this clock/timer combination is so much more useful than the start button.

Thanks!!!
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Wed May 24, 2006 5:45 pm    Post subject: Reply with quote

Quote:
Posted : 03-Apr-2006 @ http://www.autohotkey.com/forum/viewtopic.php?p=54863#54863

I recieved the following code as a "Personal Message" from Thalon and I am posting it here.

@Thalon: Thanks!. Its nicely written.



Download Thalon's Code : ButtonClock_CDT_WINXP.ahk
or View it : ButtonClock_CDT_WINXP.ahk.txt


rbt137 is referring to the above post.

Regards, Smile


Last edited by SKAN on Mon Jun 16, 2008 7:33 am; edited 1 time in total
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Wed May 24, 2006 8:37 pm    Post subject: Reply with quote

Quote:
The following post has been updated:

How to Simulate a Linear Gradient ? - Part 1
http://www.autohotkey.com/forum/viewtopic.php?p=61081#61081

Part 2 has been appended to Part 1

Dynamic Creation of a BITMAP Gradient with CreateBMPGradient()


_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Thu Jun 01, 2006 4:05 pm    Post subject: Reply with quote

Quote:
How to Disable ( Grey-out ) the Close Button?
http://www.autohotkey.com/forum/viewtopic.php?p=62506#62506


The Solution is as simple as this:

    Removing the menu item "Close" from the (Window's) System menu
    "greys out" the Close button!

    Compare the snapshots below:-

    ____

    I present here two functions that will ease the task:


    DisableCloseButton() will disable the Close button of the active window.

Code:
DisableCloseButton(hWnd="") {
 If hWnd=
    hWnd:=WinExist("A")
 hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
 nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
 DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
 DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-2,"Uint","0x400")
 DllCall("DrawMenuBar","Int",hWnd)
Return ""
}

    • Note: Disabling the Close button helps one to avoid accidental closure of a window.... Nothing more!. ALT+F4 will still close the window!


    RedrawSysmenu() will reset the System menu of the active window to default state.
Code:
RedrawSysMenu(hWnd="") {
 If hWnd=
    hWnd:=WinExist("A")
 DllCall("GetSystemMenu","Int",hWnd,"Int",TRUE)
 DllCall("DrawMenuBar","Int",hWnd)
Return ""
}


    Examples:

    Disabling the Close button of an AHK GUI :

    Code:
    Gui, +Resize
    Gui, Show, w400 h300, Demo Window
    DisableCloseButton()
    Return

    ; Copy & Paste DisableCloseButton() below


    Disabling/Enabling the Close button of any Window:

    Code:
    #F2::DisableCloseButton(WinExist("A"))
    #F3::RedrawSysmenu(WinExist("A"))
    Return

    ; Copy & Paste DisableCloseButton() and RedrawSysmenu() below


    Disabling/Enabling the Close button of all instances of Internet Explorer Windows:

    Code:
    ^#F2::
    WinGet,WindowID,List,ahk_class IEFrame
    Loop, % WindowID {
    cWindow = % WindowID%A_Index%
    DisableCloseButton(cWindow)
    }
    Return

    ^#F3::
    WinGet,WindowID,List,ahk_class IEFrame
    Loop, % WindowID {
    cWindow = % WindowID%A_Index%
    RedrawSysMenu(cWindow)
    }
    Return

    ; Copy & Paste DisableCloseButton() and RedrawSysmenu() below


    Credit:



With a little alteration to DisableCloseButton() one can disable the other two buttons, I guess!...

Feedback please!....


_________________
Suresh Kumar A N


Last edited by SKAN on Wed Sep 03, 2008 11:17 pm; edited 2 times in total
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Tue Jun 13, 2006 3:05 pm    Post subject: How to enable Drag for a GUI without a Titlebar ? Reply with quote

Quote:
In his reply to this post, Laszlo wrote:

"Goyyah, you could add a note to the original post, that a window w/o title bar can still be moved in the traditional way (with the arrow keys), by selecting Move from the Alt-Space activated context menu."

As Mr.Laszlo said: The simple way to move any window is to press ALT+Space (when the Window has the focus), and the System menu of the window will be displayed. Selecting Move will allow the user to move the window with Up/Down/Left/Right arrow keys.

In case, you want to keep a Hotkey handy in your "always-running-master-script" - The following one-liner would suffice:

<Your Hotkey>::PostMessage, 0x112, 0xF010,,, A


This quote was added on: 31-Jul-2006


Quote:
How to enable Drag for a GUI without a Titlebar ?
http://www.autohotkey.com/forum/viewtopic.php?p=64185#64185

Quote:
Foreword:

I am not sure whether the technique I am posting now has already been documented.

All I could find from forum search is the workaround Solution posted by Chris in
Ask for Help topic Movable "Borderless" SplashText or GUI- Feature

Credit: Adapted from VB example posted as Dragging a Form Without a Title Bar


How to?
  • Create a GUI without caption: Gui, -Caption.
  • Add a control (that is not input capable*) and assign a gLabel.
  • The gLabel routine should have the following line:

      - PostMessage, 0xA1, 2,,, A

    Thats it .... Now a user can click on the defined control to drag the GUI as required. Very Happy


Quote:
Important Note: This postmessage requires that the Left Mouse Button is down when being posted!
We cannot do this with a push button ( and other buttons having on/off state) because the gLabel will never get executed until we release the mouse button. So it is ideal to associate the gLabel to a static control.




How it works?

When the Left Mouse Button is down on the Titlebar, WM_NCLBUTTONDOWN ( 0xA1 ) message gets posted and that enables the window to be dragged. We are simulating the exact condition by posting WM_NCLBUTTONDOWN to the GUI.

"Exact condition" means that the drag can be cancelled with <Esc> which relocates the GUI to its previous postion.


    Here is a Copy / Paste / Try example - Enabling drag with a text control :

Code:
Gui, -Caption +ToolWindow +0x400000
Gui, Font, S14 Bold, Verdana
Gui, Add, Text, w200 h27 Border Center GuiMove, Click Here `&& Drag
Gui, Show, AutoSize
Return

uiMove:
PostMessage, 0xA1, 2,,, A
Return

GuiEscape:
Exitapp


    Result of above code - Snapshot:



    The above is just a snapshot ...
    DO NOT TRY TO DRAG IT - Wink

    An another Copy / Paste / Try example - Enabling drag with a Picture control used as a Titlebar :

Code:
IfNotExist, bg.bmp
    URLDownloadToFile
    ,http://autohotkey.net/goyyah/Tips-N-Tricks/Gradients/Caption.bmp
    ,bg.bmp

Gui, -Caption +ToolWindow +0x400000
Gui, Margin, 0, 0
Gui, Add, Picture, w400 h16 Border Center GuiMove, bg.bmp
Gui, Add, Text, y+1 w402 h280 Border
Gui, Show, AutoSize
Return

uiMove:
PostMessage, 0xA1, 2,,, A
Return

GuiEscape:
Exitapp


    Result of above code - Snapshot:



Some ideas!

    Advantages in removing the default Titlebar and enabling the drag with a control.

    • It gives the developer flexibility in declaring conditions on when the GUI can be moved or stay freezed in the current postion.
    • The GUI can equal the size of a Titlebar or may even be smaller. Full freedom in deciding the size of the GUI.
    • Enables a developer to Skin his application so that the GUI looks uniform in different Windows OSes.
    • With a simulated Titlebar it is easier to add other buttons (Its hard to mess with the regular titlebar).


      Experiment 1:

      • Download TinyClock.zip
      • The Clock can be dragged to a suitable position on the screen and be frozen there.
      • The Clock by default is Always on Top and can be set to be Always @ Bottom
      • GUI consists only a single button and it is g-labelled to show the Traymenu.


      Experiment 2 :

      • Download Media.zip
      • A "Titlebar sized" - "Drag-enabled" GUI that has a Traymenu Icon, Menu bar, Media buttons and System buttons all in one line!
      • Menu will always be shown on the top-left of the GUI occupying the WHOLE LINE!. The menu seen in the snapshot is actually a seperate GUI. The effect is made possible with a workaround involving two GUI's.
      • All pictures are icons bound into a single Library (ICL file).

      Experiment 3 : How to Simulate a GUI Titlebar ? (or) How to user define a GUI Caption ?

        Snapshot of an experimental GUI Application with an user-defined caption bar.



      • Download AHK-SE.zip

      • The grey colored Titlebar is a vertical Linear Gradient simulated with a 2 pixel Bitmap.
        See: How to Simulate a Linear Gradient ?

      • The carved-out effect of the Caption text is simulated by Superimposing two text controls.
        See: How to Display Shadowed Text in a GUI ?

      • Most windows just display the Icon on the left side of the Titlebar. I have attached the Traymenu to it! That is how a Titlebar should be when AHK-ites develop a GUI. Cool

      • This GUI does not maximize. So, I have used that button to toggle "Always On Top" setting. I never had a requirement for resizeable GUIs. If your GUI requires maximizing, it will be cool to enable double-click-on-titlebar maximizing for your GUI. I have not tried this, but should be possible.

      • One might have a need for a Menu bar. See Experiment 2 for a possible workaround.

      • Well! I am not sure how many people have this habit, but I do!

        My habit: When there is a situation of too many open windows and I am closing unwanted windows fastly! I first click on the Close button and without releasing the left mouse button I browse the window's contents. If the window has to be closed - I release the left mouse button... and if not - I move the cursor away from the Close button and the Close gets cancelled!

        I have enabled the Titlebar buttons to mimic this functionality.




Edit: Added 30-Jul-2006

Quote:
How to simulate the activated/deactivated status for a simulated Titlebar?

A window`s Title bar/Caption (sort of) greys-out when it is Not Active and looks bright
when it is the Active window!.

The current utility I am developing requires a Always-On-Top GUI with a simulated Titlebar.
The gui looks pretty neat - however with one limitation. The user would never be able to guess
(by looking at the titlebar), whether the GUI is having focus or not

My immediate solution was to use a IfWinActive in Timer routine to change the color of the Caption text.
Then did some research and found an answer to this: How to Detect Activation/Deactivation of a GUI?

Here is a Copy / Paste / Try Example:
Code:
OnMessage(0x06 , "WM_ACTIVATE")

Gui -Caption +0x800000 +AlwaysOnTop +ToolWindow
Gui, Color, FFFFE7
Gui, Margin, 0,0
Gui, Font, s9 , Verdana
Gui, Add, Text, x0 y0 +0x4   w400 h19
Gui, Add, Text, x0 y0 +0x200 w400 h19 cFFFF80 Backgroundtrans vCaption guiMove
   , % A_Space " Simulated Titlebar"
Gui, Show, h300

Return

WM_ACTIVATE(wParam, lParam) {
 IfGreaterOrEqual,wParam,1, Gui,Font,cFFFF80
 IfLessOrEqual   ,wParam,0, Gui,Font,c808080
 GuiControl, Font, Caption
}

uiMove:
  PostMessage, 0xA1, 2,,, A
Return

GuiEscape:
  ExitApp



Last edited by SKAN on Mon Jun 16, 2008 7:33 am; edited 5 times in total
Back to top
View user's profile Send private message
polyethene



Joined: 11 Aug 2004
Posts: 5154
Location: /b/

PostPosted: Tue Jun 13, 2006 3:16 pm    Post subject: Reply with quote

I found an error in your ConnectedToInternet() function. You used:

ConnectedToInternet(flag="") {
If flag=""


The if statement is not an expression so the default value of 0x40 is never set (unless two literal quotation marks were passed). Using ConnectedToInternet(flag = 0x40) would be better.

However I find that calling the function with any of the listed values doesn't work Confused
_________________
Chat (IRC)PlusNetScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Tue Jun 13, 2006 5:44 pm    Post subject: Reply with quote

Hey Goyyah... like all your other tricks, this one is really neat! thanks for sharing.
_________________
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Wed Jun 14, 2006 8:13 am    Post subject: Reply with quote

Dear Titan, Smile

You wrote:
I found an error in your ConnectedToInternet() function. You used:

ConnectedToInternet(flag="") {
If flag=""


The if statement is not an expression so the default value of 0x40 is never set (unless two literal quotation marks were passed). Using ConnectedToInternet(flag = 0x40) would be better.


Shocked Shocked
Thanks for pointing it.

You wrote:
However I find that calling the function with any of the listed values doesn't work


Have updated ConnectedToInternet(). Please try again and let me know. It works now properly with my Single user PC with ADSL connection.

Regards, Smile


Last edited by SKAN on Mon Jun 16, 2008 7:34 am; edited 2 times in total
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Wed Jun 14, 2006 8:14 am    Post subject: Reply with quote

Rajat wrote:
Hey Goyyah... like all your other tricks, this one is really neat!


Thanks Rajat! Very Happy
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
polyethene



Joined: 11 Aug 2004
Posts: 5154
Location: /b/

PostPosted: Thu Jun 15, 2006 10:35 pm    Post subject: Reply with quote

Goyyah wrote:
Have updated ConnectedToInternet(). Please try again and let me know. It works now properly with my Single user PC with ASDL connection.

No it doesn't work for me Confused
This version seems to work:
Code:
MsgBox % Connected()

Connected(fl = 0x40) {
   Return, DllCall("Wininet.dll\InternetGetConnectedState", "UInt *", fl, "UInt", 0)
}

However the flags seem to be ignored which is quite strange.
_________________
Chat (IRC)PlusNetScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6 ... 28, 29, 30  Next
Page 5 of 30

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group