AutoHotkey Community

It is currently May 25th, 2012, 1:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 3rd, 2005, 2:36 pm 
No differnece at all.
Quote:
gui, pic ...
winset, trans ...
gui, pic ...
winset, trans ...
identical to
Quote:
gui, pic ...
gui, pic ...
winset, trans ...
winset, trans ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2005, 2:52 pm 
Offline

Joined: January 30th, 2005, 11:18 pm
Posts: 133
Location: Darmstadt, Germany
Sorry for the misundarstanding, BoBo. I meant that this must be done by the AHK script compiler itself (within the C++ source of AHK).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2005, 3:00 pm 
Maybe some web geeks can help ?!
As HTA (HyperTextApplication) can handle with JavaScript, VBScript IMHO the existing scripts/samples e.g. this one [DynamicMenu] could be implemented within such a "GUI" and that GUI set to be transparent. It's that simple, isn't it ?

Rajat "God of HTA", give us a sign ! :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2005, 3:42 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
RobOtter wrote:
it seems to me like you first stack images one over the other and compute transparency in the end for the resulting over-all picture. This leads to the effect that while stacking, the transparent color is NOT treated as "not there" and will of course overwrite the underlying pixels.
IMHO you would have to compute transparency for the color of each picture at the time when it is added so that it does not overwrite pixels.
The transparency effect is global to the entire window. It doesn't matter whether the window contains pictures, or how many it contains.

At least that's the way WinSet currently does it. I think MSDN says somewhere that you cannot apply SetLayeredWindowAttributes() or WS_EX_LAYERED to child windows (i.e. controls). If true, I know of no easy way to make individual controls transparent.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2005, 4:41 pm 
Offline

Joined: January 30th, 2005, 11:18 pm
Posts: 133
Location: Darmstadt, Germany
After playing around, I nearly solved the issue with the transparency effect by using the AltSubmit option in conjunction with BackgroundTrans (using AHK 1.0.25.13):

Code:
; Add the menu pictures:
if menuExist = true
{
   Gui, 1:Show
}
else
{
Gui, 1:+LastFound +Resize
Gui, 1:Color, FF00FF
WinSet, TransColor, FF00FF

Gui, 1:Add, Picture, vNorth AltSubmit x25 y0 +BackgroundTrans, %imgPath%\ring_01_north.gif
Gui, 1:Add, Picture, vWest AltSubmit gwestClick x0 y25 +BackgroundTrans, %imgPath%\ring_01_west.gif
Gui, 1:Show
menuExist = true
}

Return

westClick:
GuiControl, 1:, West, %imgPath%\ring_01_east.gif
Return

GuiClose:
ExitApp

GuiEscape:
Gui, 1:Hide


As a remark, I tested the above only with GIF images. I found out that you have to define the color for being transparent _also_ within the image! Otherwise the above trick won´t work.

In addition, would it be easy to add an action event for "mouseOver" (aka "hover") similar to the g* action for pictures? This would greatly simplify programming a visual feedback for the user when he moves the mouse over a control. At the moment I working on that functionality using a loop which might be not very fast.

Have a nice weekend,
Rob


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2005, 7:06 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
RobOtter wrote:
you have to define the color for being transparent _also_ within the image! Otherwise the above trick won´t work.
That's interesting. The AltSubmit keyword causes the picture to be loaded with GDIPlus.dll, which apparently obeys any transparency built into the image. I knew this worked with transparent icons, but until now I didn't know it worked with GIFs.

Quote:
would it be easy to add an action event for "mouseOver" (aka "hover") similar to the g* action for pictures? This would greatly simplify programming a visual feedback for the user when he moves the mouse over a control.
I'll add it to the to-do list, though it will probably be a while. In the meantime, SetTimer+MouseGetPos is probably the easiest solution. Further up in this topic is an example I posted for how to convert mouse coordinates to picture coordinates.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2005, 12:51 am 
Offline

Joined: December 14th, 2004, 11:34 pm
Posts: 45
Location: Minneapolis, MN
Well, I wrote a little code to take in some text and format in a circle. It's a start - play with it if you'd like and provide some input.

Code:
;start of adaptable pie menu system
;AHK 1.0.20
;Tom Thomalla Jr.
;2/4/2005

Display1=TT1
Display2=TT2
Display3=TT3
Display4=TT4
Display5=TT5
Display6=TT6
Display7=TT7
Display8=TT8

;find out how many valid elements there are
loop
  {
  StringTrimRight, element, Display%a_index%, 0
   if element =
    {
    total=%a_index%
    total-=1
     break ; The end of the array has been reached.
     }
  }
 
;cosine and sine take radians
;divide a total circle by the total number of elements
;to return the radian "chunk" to use
pi=3.141592653589793
chunk=%pi%
envmult chunk, 2
envdiv chunk, %total%
;set up some basic position variable
;to be replaced later with better automatic positioning
radius=50 ;px
start_x=100
start_y=100
loop %total%
{
  ;set up the angle based on the chunk
    elem_angle=%chunk%
  ;adjust the multiplier so the first item is far right
    elem_count_adjust=%a_index%
    envsub, elem_count_adjust, 1
  ;multiple the chunk by the element number that is now adjusted
  ;will give the angle in radians where it should be placed
    envmult, elem_angle, %elem_count_adjust%
  ;start with the sin and cos for the angle
    transform elem_x, cos, %elem_angle%
    transform elem_y, sin, %elem_angle%
  ;multiply it by the radius
    envmult elem_x, %radius%
    envmult elem_y, %radius%
  ;adjust it for where to start in the box
    envadd elem_x, %start_x%
    envadd elem_y, %start_y%
  ;make the gui item
    StringTrimRight, elem_text, Display%a_Index%, 0
    gui, add, text, x%elem_x% y%elem_y%, %elem_text%
  ;adjust the item to be centered on the original x,y
    GuiControlGet, elem_, Pos, Static%a_index%
    envdiv elem_w, 2
    envdiv elem_h, 2
    envsub elem_x, %elem_w%
    envsub elem_y, %elem_h%
    guicontrol, move, Static%a_index%, x%elem_x% y%elem_y%
}
gui, show
return

GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 8:07 am 
Offline

Joined: January 30th, 2005, 11:18 pm
Posts: 133
Location: Darmstadt, Germany
3tones, thanks for sharing this, it works very well! I reuse it for positioning my images instead of text.

There is some other question that bubbled up and is a more conceptual one:
What will happen if a menu is opened at the border of the screen, so near that the menu item (or its submenu items that may lie behind) would be off-screen? A simple repositioning would confuse the user and would also destroy the complete idea of pie menus. None of the resources I´ve read about pie menus deal with this problem and while I´m working hard on the technical problems and had some success lately, I´m stuck on this question :(

Do you have any ideas?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 3:17 pm 
Offline

Joined: December 14th, 2004, 11:34 pm
Posts: 45
Location: Minneapolis, MN
I can't think of a good way around this. There are a few options... leave it off screen, and the user will figure out they shouldn't do that. Move it flush with the side, which would throw off moving the mouse in the same direction to get a paticular item. Wait... I got it... if it is off screen, just move the menu box AND the mouse cursor to be centered in the new box.

In other news, I've been working on "hotspots" Right now I have it so that when you mouse over the text, it will change colors. My next idea is to create pie-shaped hotspots, so that as soon as you go off the center of the pie menu, it will change the color of the text you are going to. I will basically monitor the mouse position and constantly figure out what "piece of the pie it is in." In case you haven't noticed, I've been taking a text only approach to get the framework in place.

One more thing... I think I have my sin/cos functions messed up. My "unit circle" goes the wrong way according to trig because I wan't paying attention. I am thinking of standardizing my code to work like a clock anyway - I think that would be easier to grasp for most users. I can see it now - why does the first item show at "3 o'clock"?

Tom


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2005, 11:18 pm 
Offline

Joined: January 30th, 2005, 11:18 pm
Posts: 133
Location: Darmstadt, Germany
Thanks for your suggestions!
Moving the menu and also the mouse might be the least bad solution... Today I tried the radial context plugin for Firefox and it has an interesting feature: You can manually drag the whole menu to where you want, even if dragging is not necessary.

In contrary to your text-based approach, I am working only with images having transparency to shape them properly. This makes it much easier to track the correct clicking area.

Quote:
One more thing... I think I have my sin/cos functions messed up. My "unit circle" goes the wrong way according to trig because I wan't paying attention. I am thinking of standardizing my code to work like a clock anyway - I think that would be easier to grasp for most users. I can see it now - why does the first item show at "3 o'clock"?


Uhm... maybe math cannot be fooled? :wink: -- Sorry, no offense!
The usual result for cos(X) and sin(Y) at zero degree is obviously at the left 8)
After trying hard to remember my long-ago math lessons, I rebuilt the positioning code from scratch, also supporting center offsets, starting angles and variable number of objects:

Code:
    SetFormat, float, 0.10
    numItems := 4
    radius := 50
   
    ; Degree! You can set this to any other value, e.g. -90 to start at the
    ; top (12 o´clock) if using four items
    angle := 0
   
    ; use this constant or compute radient yourself by: angle_rad = pi * angle_degree / 180
    RADIENT = 0.0174532925199433
    perItemAngle = 360
    perItemAngle /= %numItems%
   
    ; position the images around this point within the window
    offX := 100
    offY := 100
   
    loop, %numItems%
    {
      radientAngle = %RADIENT%
      radientAngle *= %angle%
     
      ; formula: picX = radius * cos(radientAngle) - hotspotX + offX
      ; where hotspotX can be set to the horizontal center of the image
      picX = %radius%
      transform cosX, cos, %radientAngle%
      picX *= %cosX%
      hotspotX := r%ringCount%_i%A_Index%_hotspotX
      picX -= %hotspotX% ; move to center of image
      picX += %offX%     ; move to center of window
     
      ; formula: picY = radius * sin(radientAngle) - hotspotY + offY
      ; where hotspotY can be set to the vertical center of the image
      picY = %radius%
      transform sinY, sin, %radientAngle%
      picY *= %sinY%
      hotspotY := r%ringCount%_i%A_Index%_hotspotY
      picY -= %hotspotY% ; move to center of image
      picY += %offY%     ; move to center of window
     
      Gui, 1:Add, Picture, AltSubmit x%picX% y%picY% +BackgroundTrans, %imgPath%\%picName%
     
      angle += %perItemAngle%
     
      ; Paranoia code - should not ever occur in our code
      if %angle% >= 360
      {
        angle = 0
      }
    }


Best regards and good night (nearly midnight here),
Rob


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Bon, Exabot [Bot], Hodofca, MSN [Bot], Rajat and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group