Reposition All Controls After Autoresizing A Control

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Roonyroo
Posts: 36
Joined: 29 Jan 2014, 20:29

Reposition All Controls After Autoresizing A Control

08 Feb 2014, 12:47

I'm trying to reposition a control after I resize the previous box

Bsically instead of a large gap after resizing the control, I want the control after the resized box, to start next to the resized edit box ...

So type something in box c & box d repositions itself next to box c, as do all the boxes after it

But only on the current line of the edit box ...

The variable im using to reposition "xsxc" is at line 98

I've also extracted the size of the string in the editbox at line 91 labelled "length"

Much appreciated, thanks!!!

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.



autotrim, off

msgbox type in guiwinx to mirror in 2nd win

setBatchLines -1
lp=0
y:=10
gui,4:add,text,section -vscroll x0   y%y% w0 h0,    ;-- set position for y
loop,10
{
loop,7
  {
  lp++
  Gui, 4:Add, Edit, r2 -vscroll x+7 y%y% w90 h30 gCopyText vedit%lp%
  }
gui,4:add,text,  section -vscroll x0   y0  w0 h0,    ;-- set position for x
y +=35
}
lp:=0

Gui,4:show,autosize  x0 y150 h900,guiWINxx



setBatchLines -1
lp=0
y:=10
gui,4:add,text,section x0   y%y% w0 h0,    ;-- set position for y
loop,10
{
loop,7
  {
  lp++
  
  
  Gui, 5:Add, Edit, x+7 y%y% w90 h30 -Multi veditx%lp%
  }
gui,5:add,text,  section x0   y0  w0 h0 ,    ;-- set position for x
y +=35
}

Gui,5:show,autosize x702 y250 h900, inputx







CopyText: 

{

 Gui, 4: Submit, nohide ; directs all text typed to gui box 1
ControlGetFocus, OutputVar, guiWINxx

newvarcsx := RegExReplace( OutputVar, "\D")

xsc:=newvarcsx-1

xscd=edit%xsc%

    ControlGetPos, xs, ys, ws, hs, %OutputVar%, guiWINxx
    
    ControlGetPos, xsx, ysx, wsx, hsx, %xscd%, guiWINxx

   
ControlGetText, whcyxc, %OutputVar%, guiWINxx

edit4:=""

newvarcsxt := RegExReplace( OutputVar, "\D")

tooltip, %OutputVar% %whcyxc%

StringReplace, text, MyText,%A_Space%,_, All

iniwrite, %whcyxc%, %x1%, winxlxc, winxlxc%newvarcsxt%


StringReplace, text, whcyxc,_, %A_Space% , All


  StringLen, length, text
  
  length:=length*7


ys:=ys-25
ysx:=ysx-25
xsxc:=xsx-length ; move textbox to position ending of preceding textbox



tooltip,  %OutputVar% xs%xs% ys%ys% %text% %xscd% xsx%xsx% ysx%ysx% ws%ws%

   GuiControl, 5:Text, %OutputVar%, % text

   
   GuiControl, 5:Move, %OutputVar%, x%xsxc% y%ysx% w%length% h100

    ControlGetPos, xs, ys, ws, hs, %OutputVar%, guiWINxx
    
    
    
;settimer, spacex, 10
}


return 





Zelio
Posts: 278
Joined: 30 Sep 2013, 00:45
Location: France

Re: Reposition All Controls After Autoresizing A Control

17 Feb 2014, 07:56

No reply after one week, maybe nobody understand your problem, and it seems a logic problem of what you want to do, or can you rephrase with a simple example script?

Therefore use ControlGetPos and GuiControl, myGui:Move seems enought in a well made loop, as you already did in your prototype, maybe add some MsgBox to check if you really get your value.

Also, be aware of which Gui is focused and what your CoorMode will watch (the whole screen, focused Gui control = client = window without the title bar,... )

Good Luck!
Roonyroo
Posts: 36
Joined: 29 Jan 2014, 20:29

Re: Reposition All Controls After Autoresizing A Control

19 Feb 2014, 20:57

Thanks, solved after brainstorming in irc

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Hugh Jars, Mateusz53, MrDoge, peter_ahk and 388 guests