 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Mar 09, 2005 6:12 pm Post subject: On screenboard feature re |
|
|
Very nice work on this onscreenkeyboard.
However there are two things that I would like help on making.
The keyboard doesnt display more than one keys pressed and i need this to work for a project i am working on.
Then, would it be possible to also have the mouse click display?
I am making video tutorials on how to learn a 3d program and it would be very useful.
Thanks |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Thu Mar 10, 2005 12:32 pm Post subject: |
|
|
I checked the on-screen keyboard script and unfortunately, there doesn't seem to be an easy way to make it indicate that more than one key is down simultaneously. This is because the displayed keys are actually buttons, and the OS doesn't seem to allow more than one button to be down-and-focused at the same time.
A possible workaround is to redesign the script to use bordered text controls instead of buttons, which would allow a border or other edge-effect to be drawn around multiple controls simultaneously (and later removed when the corresponding keys are released). |
|
| Back to top |
|
 |
peejay
Joined: 04 Mar 2005 Posts: 40 Location: Netherlands
|
Posted: Thu Mar 10, 2005 4:45 pm Post subject: |
|
|
Maybe you could use images as well (two images for each key: one pressed, one unpressed).
At least, I suppose images used in a GUI are added to the executable during the compilation? I haven't really gone down that alley yet...
>>> Update: won't work. See Chris' answer. _________________ The Gods smile upon you. Beware - it is probably because they know what is going to happen to you next, and find it amusing. To them, anyway. --- Discworld Horrorscope: http://www.weirdnes.force9.co.uk/stars3.html
Last edited by peejay on Fri Mar 11, 2005 9:39 am; edited 1 time in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Fri Mar 11, 2005 1:07 am Post subject: |
|
|
| peejay wrote: | | images used in a GUI are added to the executable during the compilation? | Not currently, though there may be an option for that someday. |
|
| Back to top |
|
 |
peejay
Joined: 04 Mar 2005 Posts: 40 Location: Netherlands
|
Posted: Fri Mar 11, 2005 9:32 am Post subject: |
|
|
| Chris wrote: | | peejay wrote: | | images used in a GUI are added to the executable during the compilation? | Not currently, though there may be an option for that someday. |
Pity, that's a big NoGo on my idea...
Is this on the WishList yet? _________________ The Gods smile upon you. Beware - it is probably because they know what is going to happen to you next, and find it amusing. To them, anyway. --- Discworld Horrorscope: http://www.weirdnes.force9.co.uk/stars3.html |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4065 Location: Pittsburgh
|
Posted: Sat Mar 12, 2005 6:12 pm Post subject: |
|
|
| Why is the picture file loading a problem? You only need two: button-up and button-down. You can put the characters on the top of them. If any extra file is prohibited, you can use narrow GroupBoxes to draw rectangular images, like buttons. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Sun Mar 13, 2005 12:38 am Post subject: |
|
|
I think that would work. Anyone can feel free to modify the on-screen keyboard script with something like that.
By the way, I recently changed it to re-enable the tab key visualization because somewhere along the way, the bug that prevented it from working was fixed. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4065 Location: Pittsburgh
|
Posted: Sun Mar 13, 2005 4:00 am Post subject: |
|
|
Box test
The height of a GroupBox is funny: 0 height is given as 10. If the height is specified as 9, it gives a negative fold over, and the result is a 2 pixel wide dark line. Let's call it black. If the height is 11, we get a 2 pixel wide light gray line, what we can call white. On the other hand, the width of a GroupBox folds over at 2 pixels, so width 1 gives a black vertical line, width 3 gives a white vertical line. We can draw boxes by appropriately positioning them. The top-left box in the Gui window (drawn by the script below) imitates a pressed down button. Observe, however, that the corners are not perfect. Still, these lines can be used to draw complex buttons with some 3D effects.
For drawing rectangular buttons it is enough to add two GroupBoxes in the right order, with their sides offset by 2 pixels. The results are buttons in recognizable up or down position, shown in the top row of the Gui window, the middle and right boxes. These provide the best we can achieve.
On high resolution screens wider boarders look better. Three offset GroupBoxes give the result shown in the Gui window: the lower second and third buttons.
Unfortunately, the old style line drawing characters are not part of the ANSI character set. If you want to use text characters to draw lines, only the "_" and "|" are available. Using them requires each piece to be positioned carefully, and we cannot be sure if another PC with slightly different font metrics will show the lines correctly. But they can be 100% black or white, or any other color you like. In the second row of the Gui window drawn by the script below the pieces are joined (except at the corners, where overlapping parts are covered), assuming the Windows 2000 character set, 1600x1200 screen resolution, large system fonts. Your mileage will definitely vary, but you can add highlighting to some parts of your graphic. | Code: | Gui Add, GroupBox, x20 y15 w1 h80, ; black vertical line
Gui Add, GroupBox, x100 y15 w3 h82, ; white vertical line
Gui Add, GroupBox, x19 y16 w82 h9, ; black horizontal line
Gui Add, GroupBox, x19 y86 w82 h11, ; white horizontal line
Gui Add, GroupBox, x127 y15 w78 h78, ; button
Gui Add, GroupBox, x126 y14 w80 h80, ; up
Gui Add, GroupBox, x225 y13 w82 h80, ; button
Gui Add, GroupBox, x226 y14 w80 h78, ; down
Gui Font, cWhite S20 W1000, Arial
Gui Add, Text, x26 y97 w200, ____
Gui Font, cRed S20 W1000, Arial
Gui Add, Text, x18 y156, |
Gui Add, Text, x18 y133, |
Gui Font, cBlack S20 W1000, Arial
Gui Add, Text, x26 y161 w200, ____
Gui Font, cBlue S20 W1000, Arial
Gui Add, Text, x98 y156, |
Gui Add, Text, x98 y129, |
Gui Add, GroupBox, x127 y115 w78 h78, ; wide border
Gui Add, GroupBox, x126 y114 w80 h80, ; button
Gui Add, GroupBox, x125 y113 w82 h82, ; up
Gui Add, GroupBox, x225 y113 w82 h80, ; wide border
Gui Add, GroupBox, x226 y114 w80 h78, ; button
Gui Add, GroupBox, x227 y115 w78 h76, ; down
Gui Show, Center h220 w325, Box Test |
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4065 Location: Pittsburgh
|
Posted: Mon Mar 14, 2005 8:53 pm Post subject: |
|
|
I found the reason, why the GroupBox height wraps around 10 pixels: it tries to leave room for the description text and the default character size is 10 pt. To make the behavior more consistent, specify the smallest font, 1pt before drawing horizontal lines. You can set it back to 10 pt afterwards. It would change the first 4 lines in the script above to | Code: | Gui Font, S1
Gui Add, GroupBox, x20 y15 w1 h80, ; black vertical line
Gui Add, GroupBox, x99 y14 w3 h82, ; white vertical line
Gui Add, GroupBox, x19 y15 w82 h2, ; black horizontal line
Gui Add, GroupBox, x19 y92 w82 h4, ; white horizontal line | As you see, the height folds over at 3, instead of 10. Still, the top left and bottom right corners are not prefect, so whenever possible use the other method, the offset fat boxes. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|