From: Reventlov on
Hello,
I'm writing this hta to transform values between km, m, hm, etc (but also litres, kg,
square metres)

In the window_onload sub I have the window.resize and window.moveto methods.
Often (but not always) when I run the hta I have an "access denied" error on the line with
window.resize.
I tried self.moveto and self.resize and I had the same problem.
It's something like the window is not yet available to receive commands.
It happens when the hta is run from the desktop.
I moved the commands after the assignment of the values to the array in order to let the
hta be aware of being loaded, but it didn't work.
Are there other methods to resize an hta window?
Thank you.

Giovanni


------------------------------------------

<html>
<head>
<title>Equivalenze - Cenati Giovanni</title>
<HTA:APPLICATION
ID="objHTAEquivalenze"
APPLICATIONNAME="Equivalenze"
SCROLL="no"
SINGLEINSTANCE="no"
>

<style>

</style>

<script language="vbscript">
'Equivalenze.hta
'Cenati Giovanni
'http://digilander.libero.it/Cenati
Dim marca(10,10) ' variabile globale
Sub Window_Onload
marca(1,0)="kg - kilogrammi"
marca(1,1)="hg - ettogrammi"
marca(1,2)="dag - decagrammi"
marca(1,3)="g - grammi"
marca(1,4)="dg - decigrammi"
marca(1,5)="cg - centigrammi"
marca(1,6)="mg - milligrammi"
marca(2,0)="kl - kilolitri"
marca(2,1)="hl - ettolitri"
marca(2,2)="dal - decalitri"
marca(2,3)="l - litri"
marca(2,4)="dl - decilitri"
marca(2,5)="cl - centilitri"
marca(2,6)="ml - millilitri"
marca(3,0)="km - kilometri"
marca(3,1)="hm - ettometri"
marca(3,2)="dam - decametri"
marca(3,3)="m - metri"
marca(3,4)="dm - decimetri"
marca(3,5)="cm - centimetri"
marca(3,6)="mm - millimetri"
marca(4,0)="km2 - kilometri quadrati"
marca(4,1)="hm2 - ettometri quadrati"
marca(4,2)="dam2 - decametri quadrati"
marca(4,3)="m2 - metri quadrati"
marca(4,4)="dm2 - decimetri quadrati"
marca(4,5)="cm2 - centimetri quadrati"
marca(4,6)="mm2 - millimetri quadrati"
marca(5,0)="km3 - kilometri cubi"
marca(5,1)="h3 - ettometri cubi"
marca(5,2)="dam3 - decametri cubi"
marca(5,3)="m3 - metri cubi"
marca(5,4)="dm3 - decimetri cubi"
marca(5,5)="cm3 - centimetri cubi"
marca(5,6)="mm3 - millimetri cubi"

window.ResizeTo 800,250
window.MoveTo 50,50
'Carico il primo elenco di misure
For i= 0 To 6
Da1.options(i).text=marca(1, i)
A1.options(i).text=marca(1, i)
Next
End Sub

Sub Calcola

'Devo spostare la virgola di quante posizioni?
Posizioni=A1.value - da1.value
'Se � una misura di metri quadri raddoppio le posizioni
If Misure.value=4 Then posizioni=posizioni*2
'Se � una misura di metri cubi triplico le posizioni
If Misure.value=5 Then posizioni=posizioni*3
'E calcolo il risultato
'MsgBox Da1.value & "..." & A1.value & " " & Posizioni
On Error Resume Next 'Errore se valore � stringa vuota
Risultato1.value= Valore1.value* 10^(posizioni)
On Error Goto 0

end Sub

Sub Cancella 'Quando seleziono la casella col valore da modificare
Risultato1.value=""
End Sub

Sub Aggiorna 'Quando cambia l'unit� di misura
For i= 0 To 6
Da1.options(i).text=marca(misure.value, i)
A1.options(i).text=marca(misure.value, i)
Next
Calcola ' Perch� si pu� passare a metri quadrati o cubi.
End Sub
</script>

</head>
<body style="background-color: #ffcc99;">
<h1>Equivalenze</h1>
Misure di <select size="1" name="Misure" onchange="Aggiorna">
<option value="1">g - grammi - Peso e massa</option>
<option value="2">l - litri - capacit�</option>
<option value="3">m - metri - lunghezza</option>
<option value="4">m2 - metri quadrati - superficie</option>
<option value="5">m3 - metri cubi - volume</option>
</select>
<p>
<select size="1" name="Da1" onchange="Calcola">
<option value="1">kg - kilogrammi</option>
<option value="2">hg - ettogrammi</option>
<option value="3">dag - decagrammi</option>
<option value="4">g - grammi</option>
<option value="5">dg - decigrammi</option>
<option value="6">cg - centigrammi</option>
<option value="7">mg - milligrammi</option>
</select>

&nbsp;<input name="Valore1" onfocus="Cancella" onblur="Calcola"> =&nbsp;
<select size="1" name="A1" onchange="Calcola">
<option value="1">kg - kilogrammi</option>
<option value="2">hg - ettogrammi</option>
<option value="3">dag - decagrammi</option>
<option value="4">g - grammi</option>
<option value="5">dg - decigrammi</option>
<option value="6">cg - centigrammi</option>
<option value="7">mg - milligrammi</option>
</select>

&nbsp;<input readonly="readonly" name="Risultato1"><br>

<br>

<br>
Cenati Giovanni
<br>

</body>
</html>

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
From: "Dave "Crash" Dummy" on
Reventlov wrote:
> Hello,
> I'm writing this hta to transform values between km, m, hm, etc (but also litres, kg,
> square metres)
>
> In the window_onload sub I have the window.resize and window.moveto methods.
> Often (but not always) when I run the hta I have an "access denied" error on the line with
> window.resize.
> I tried self.moveto and self.resize and I had the same problem.
> It's something like the window is not yet available to receive commands.
> It happens when the hta is run from the desktop.
> I moved the commands after the assignment of the values to the array in order to let the
> hta be aware of being loaded, but it didn't work.
> Are there other methods to resize an hta window?
> Thank you.

<snipped>

Try moving the resizeTo code to the end of your page:

</body>

<script type="text/vbs">
window.ResizeTo 800,250
window.MoveTo 50,50
</script>

</html>

--
Crash

What happens online, stays online.
From: Reventlov on
Il giorno Tue, 31 Aug 2010 10:45:01 -0400, "Dave \"Crash\" Dummy"
<invalid(a)invalid.invalid> ha scritto:

>Reventlov wrote:
>> I'm writing this hta to transform values between km, m, hm, etc (but also litres, kg,
>> square metres)
>>
>> In the window_onload sub I have the window.resize and window.moveto methods.
>> Often (but not always) when I run the hta I have an "access denied" error on the line with
>> window.resize.
>> Are there other methods to resize an hta window?
>
><snipped>
>
>Try moving the resizeTo code to the end of your page:
></body>
><script type="text/vbs">
> window.ResizeTo 800,250
> window.MoveTo 50,50
></script>
></html>

Thank you, Crash.
This will probably allow me to set the values of the combo boxes from the vbs code instead
than in the html tags.
I'm new to hta mechanisms. I'm only trying to easily check my daughter's homeworks.
Giovanni.

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
From: Kenneth A. Larsen on

"Reventlov" <noone(a)no.void> wrote in message
news:4c7d1633.4479421(a)powernews.libero.it...
> Il giorno Tue, 31 Aug 2010 10:45:01 -0400, "Dave \"Crash\" Dummy"
> <invalid(a)invalid.invalid> ha scritto:
>
>>Reventlov wrote:
>>> I'm writing this hta to transform values between km, m, hm, etc (but
>>> also litres, kg,
>>> square metres)
>>>
>>> In the window_onload sub I have the window.resize and window.moveto
>>> methods.
>>> Often (but not always) when I run the hta I have an "access denied"
>>> error on the line with
>>> window.resize.
>>> Are there other methods to resize an hta window?
>>
>><snipped>
>>
>>Try moving the resizeTo code to the end of your page:
>></body>
>><script type="text/vbs">
>> window.ResizeTo 800,250
>> window.MoveTo 50,50
>></script>
>></html>
>
> Thank you, Crash.
> This will probably allow me to set the values of the combo boxes from the
> vbs code instead
> than in the html tags.
> I'm new to hta mechanisms. I'm only trying to easily check my daughter's
> homeworks.
> Giovanni.
>
> --
> Giovanni Cenati (Bergamo, Italy)
> Write to "Reventlov" at katamail com
> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
> --


Is script and html used for the internet? I know I said that I wasn't going
to write anymore posts. But Todd said I can just reply to any newsgroups if
I have a question.