In an HTA, is it possible to re-position and/or resize controls, like buttons
and list boxes on the fly?

If so, could someone please post example code as to how to do it?

Thanks for your help...

Re: Reposition and/or resize controls on the fly by Ayush

Ayush
Thu May 10 02:02:18 CDT 2007

[XP]s message :
> In an HTA, is it possible to re-position and/or resize controls, like buttons
> and list boxes on the fly?

Yes, use CSS. e.g. To change width/height - use element.style.width=NEW_WIDTH
To move an element, you can use Position -absolute/relative with left,top etc.:
http://www.barelyfitz.com/screencast/html-training/css/positioning/
http://www.tizag.com/cssT/position.php

You can also reappend the element to move it
e.g. move an input box before a select element:
mySelect.parentElement.insertBefore(inputElem,mySelect)


> If so, could someone please post example code as to how to do it?


<script language="vbscript">

Sub resizeElem
mySelect.style.width="100px"
End Sub

Sub moveInput
inputElem.style.position="relative"
inputElem.style.left="22px"
End Sub
</script>

<select id="mySelect">
<option>A
<option>B
<option>C
</select><br>
<button onclick="resizeElem">Resize the select</button>
<br><br>
<input id="inputElem"><br>
<button onclick="moveInput">Move input</button>

Re: Reposition and/or resize controls on the fly by XP

XP
Thu May 10 08:08:02 CDT 2007

Hi Ayush,

As usual, awesome assistance! Thanks!

"Ayush" <"ayushmaan.j[aatt]gmail.com" wrote:

> [XP]s message :
> > In an HTA, is it possible to re-position and/or resize controls, like buttons
> > and list boxes on the fly?
>
> Yes, use CSS. e.g. To change width/height - use element.style.width=NEW_WIDTH
> To move an element, you can use Position -absolute/relative with left,top etc.:
> http://www.barelyfitz.com/screencast/html-training/css/positioning/
> http://www.tizag.com/cssT/position.php
>
> You can also reappend the element to move it
> e.g. move an input box before a select element:
> mySelect.parentElement.insertBefore(inputElem,mySelect)
>
>
> > If so, could someone please post example code as to how to do it?
>
>
> <script language="vbscript">
>
> Sub resizeElem
> mySelect.style.width="100px"
> End Sub
>
> Sub moveInput
> inputElem.style.position="relative"
> inputElem.style.left="22px"
> End Sub
> </script>
>
> <select id="mySelect">
> <option>A
> <option>B
> <option>C
> </select><br>
> <button onclick="resizeElem">Resize the select</button>
> <br><br>
> <input id="inputElem"><br>
> <button onclick="moveInput">Move input</button>
>

Re: Reposition and/or resize controls on the fly by Ayush

Ayush
Thu May 10 09:49:27 CDT 2007

[XP]s message :
> Hi Ayush,
>
> As usual, awesome assistance! Thanks!

You're welcome XP.

Good Luck, Ayush.
--
XP-Tips & Tricks [Use keyboard shortcuts] :
http://www.microsoft.com/windowsxp/using/setup/tips/kbshortcuts.mspx