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 

Gui FIX, please help

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
FireGirl



Joined: 04 May 2007
Posts: 88

PostPosted: Fri May 16, 2008 12:11 pm    Post subject: Gui FIX, please help Reply with quote

Hello, could someone please help me with this? Thanks to Z Gecko immensely for the kind assistance earlier getting it this far... Smile

Basically, I would like this to work on all 4 sides, ... the code allows the grabbing of the GUI to expand or reduce it from the interior... but only works on the right side! Can anyone see how to make it work evenly on the Left, Top & Bottom too? Smile Thank you very much, for any assistance rendered would be greatly appreciated and Welcome...


Code:


xsize = 478
ysize = 478
xoffset = 40
yoffset = 40

xoffsethigh := xsize - xoffset
yoffsethigh := ysize - yoffset

Gui, -Border -caption +ToolWindow
Gui, Color, D3407E
Gui, Show, w%xsize% h%ysize%, a %xsize%x%ysize% GUI
WinGet, active_id, ID, A
OnMessage(0x201, "GUI_Expand")
return

GUI_Expand(wParam, lParam)
{
   global
   MouseGetPos, Xpos, Ypos, OutputvarWin,
    if (OutputvarWin = active_ID)
    {
      WinGetPos, winXpos, winYpos, Xsize, Ysize, ahk_id %active_ID%
       if ( (Xpos > xoffsethigh) and (Ypos > yoffset or Ypos < yoffsethigh) )
       {
         loop
         {
            GetKeyState, state, LButton
               if state = D
               {
                  prevXpos := Xpos
                  MouseGetPos, Xpos, Ypos,
                  Xsize := Xsize + Xpos - prevXpos
               Gui, Show, w%xsize% h%ysize%, a %xsize%x%ysize% GUI
               xoffsethigh := xsize - xoffset
               yoffsethigh := ysize - yoffset
               }
               else
                  break
            }
       }
   }
return
}

Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 417
Location: canada

PostPosted: Fri May 16, 2008 3:51 pm    Post subject: Reply with quote

Im guarantied theres a better way of doing this. but heres my 5 minute attempt.

This makes the bottom part resizable..

Code:

xsize = 478
ysize = 478
xoffset = 40
yoffset = 40

xoffsethigh := xsize - xoffset
yoffsethigh := ysize - yoffset

Gui, -Border -caption +ToolWindow
Gui, Color, D3407E
Gui, Show, w%xsize% h%ysize%, a %xsize%x%ysize% GUI
WinGet, active_id, ID, A
OnMessage(0x201, "GUI_Expand")
return

GUI_Expand(wParam, lParam)
{
   global
   MouseGetPos, Xpos, Ypos, OutputvarWin,
    if (OutputvarWin = active_ID)
    {
      WinGetPos, winXpos, winYpos, Xsize, Ysize, ahk_id %active_ID%
       if ( (Xpos > xoffsethigh) and (Ypos > yoffset or Ypos < yoffsethigh) )
       {
         loop
         {
            GetKeyState, state, LButton
               if state = D
               {
                  prevXpos := Xpos
                  MouseGetPos, Xpos, Ypos,
                  Xsize := Xsize + Xpos - prevXpos
               Gui, Show, w%xsize% h%ysize%, a %xsize%x%ysize% GUI
               xoffsethigh := xsize - xoffset
               yoffsethigh := ysize - yoffset
               }
               else
                  break
            }
       }


       if ( (Ypos > yoffsethigh) and (Xpos > xoffset or Xpos < xoffsethigh) )
       {
         loop
         {
            GetKeyState, state, LButton
               if state = D
               {
                  prevYpos := Ypos
                  MouseGetPos, Xpos, Ypos,
                  Ysize := Ysize + Ypos - prevYpos
               Gui, Show, w%xsize% h%ysize%, a %xsize%x%ysize% GUI
               xoffsethigh := xsize - xoffset
               yoffsethigh := ysize - yoffset
               }
               else
                  break
            }
       }

   }
return
}

_________________
-=Raz=-
Back to top
View user's profile Send private message
FireGirl



Joined: 04 May 2007
Posts: 88

PostPosted: Fri May 16, 2008 5:48 pm    Post subject: Reply with quote

Hey Razlin, that is quite magnificent!! Smile I spent a loong time trying to figure out something that even worked this way, but got very poor or wacky performance.

Please help me with this a little more if you may. Basically, the main gotcha I see is the corners.... so I've made this little diagram,



... it would be quite amazing if it could work this way.... whereas in Yellow is the part which adjusts the Height/Width of the GUI logically.... the part is Blue is not needed, but would be great if that part could be clicked anyway. It doesn't need to do anything..., but could be available for some hotcliking to some { TBA function }. Could you pleease help me with this as you seem quite Brilliant in your ease of seeing the sea of possible here with what I posted?
Back to top
View user's profile Send private message
Wouther



Joined: 01 May 2007
Posts: 79
Location: The Netherlands

PostPosted: Fri May 16, 2008 9:15 pm    Post subject: Reply with quote

It took some time, but it was an interesting problem so it was not boring to do. This is my 'solution':
Code:
WinW := 478
WinH := 478
WinX := (A_ScreenWidth - WinW) / 2
WinY := (A_ScreenHeight - WinH) / 2
OffsetLeft := 40
OffsetTop := 40
OffsetRight := WinW - OffsetLeft
OffsetBottom := WinH - OffsetTop

Gui, -Border -Caption +ToolWindow
Gui, Color, D3407E
Gui, Show, x%WinX% y%WinY% w%WinW% h%WinH%, A %WinW%x%WinH% GUI
WinGet, ActiveID, ID, A
OnMessage(0x201, "GUI_Expand")


return


GUI_Expand(wParam, lParam)
{
   global
   MouseGetPos, MouseX, MouseY, MouseWin
   If (MouseWin != ActiveID)
      Return
   WinGetPos, WinX, WinY, WinW, WinH, ahk_id %ActiveID%
   OffsetRight := WinW - OffsetLeft
   OffsetBottom := WinH - OffsetTop

   If (MouseX > OffsetRight)
      Loop
      {
         If !GetKeyState("LButton")
            Break
         prevMouseX := MouseX
         MouseGetPos, MouseX
         WinW += MouseX - prevMouseX
         Gui, Show, w%WinW%
      }

   If (MouseX < OffsetLeft)
      Loop
      {
         If !GetKeyState("LButton")
            Break
         prevMouseX := MouseX
         MouseGetPos, MouseX
         WinX += MouseX - prevMouseX
         WinW -= MouseX - prevMouseX
         Gui, Show, x%WinX% w%WinW%
      }

   If (MouseY > OffsetBottom)
      Loop
      {
         If !GetKeyState("LButton")
            Break
         prevMouseY := MouseY
         MouseGetPos,, MouseY
         WinH += MouseY - prevMouseY
         Gui, Show, h%WinH%
      }

   If (MouseY < OffsetTop)
      Loop
      {
         If !GetKeyState("LButton")
            Break
         prevMouseY := MouseY
         MouseGetPos,, MouseY
         WinY += MouseY - prevMouseY
         WinH -= MouseY - prevMouseY
         Gui, Show, y%WinY% h%WinH%
      }
}
It makes all four sides resizable Very Happy, but it does blink a lot when resizing the top and the left sides.Confused
_________________
Printing css/html-formatted text
Back to top
View user's profile Send private message
FireGirl



Joined: 04 May 2007
Posts: 88

PostPosted: Mon May 19, 2008 1:14 am    Post subject: Reply with quote

Say, I am wondering if anyone can see why this code is failing? I know this is extremely hard stuff, and I couldn't even get it to second base.... but could someone look at the graphic I presented, and maybe see why this code flickers, or is just not grabbing on the other sides like I want it to? Have a wonderful week and thanks! Very Happy
Back to top
View user's profile Send private message
toralf n-l-i
Guest





PostPosted: Mon May 19, 2008 6:25 am    Post subject: Reply with quote

Such a method has been used in the Lil'Builder script. I know it is somehow hard to digest this big script, but you should be able to spot the right section.
Back to top
FireGirl



Joined: 04 May 2007
Posts: 88

PostPosted: Mon May 19, 2008 7:27 am    Post subject: Reply with quote

I am not sure, but I don't want to alienate my chances of either repairing the last posters version, which -almost- has it, or someone giving me a guiding hand. Are you saying, that huge other thread, has some function in there I should be paying attention to? That might help me here? Smile Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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