Privat erkan kaplan Eval Funktion: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:


# Eval()
* Eval()


The Eval() function executes a JavaScript string. Consider the following:
The Eval() function executes a JavaScript string. Consider the following:
 
<pre>
For i= 1 To 3
For i= 1 To 3
   myControl = Eval("Button" + i)
   myControl = Eval("Button" + i)
   Print myControl.value
   Print myControl.value
Next
Next
</pre>
<pre>
Rem Constant Variables
Dim c1
c1=10         
   
Function Hesapla(controlNr)
  Dim iTop, iLeft, iWidth, iHeight, iMiddle
  iTop = Eval("btn"&controlNr).Top              '300
  iLeft = Eval("btn"&controlNr).Left            '50
  iWidth = Eval("btn"&controlNr).Width          '100
  iHeight = Eval("btn"&controlNr).Height        '30
  iMiddle = iLeft+(iWidth/2)      '101
 
  Icon.Left = (iMiddle-(Icon.Width/2))
  Icon.Top = (iTop-c1)-Icon.Height
End Function
Function btn1_onclick()
  Call Hesapla("1")    'btn1
End Function
Function btn2_onclick()
    Call Hesapla("2")    'btn2
End Function
</pre>

Latest revision as of 21:23, 20 May 2013

  • Eval()

The Eval() function executes a JavaScript string. Consider the following:

For i= 1 To 3
  myControl = Eval("Button" + i)
  Print myControl.value
Next


Rem Constant Variables
Dim c1
c1=10           
     
Function Hesapla(controlNr)
  Dim iTop, iLeft, iWidth, iHeight, iMiddle
  iTop = Eval("btn"&controlNr).Top               '300
  iLeft = Eval("btn"&controlNr).Left             '50
  iWidth = Eval("btn"&controlNr).Width           '100
  iHeight = Eval("btn"&controlNr).Height         '30
  iMiddle = iLeft+(iWidth/2)      '101
  
  Icon.Left = (iMiddle-(Icon.Width/2))
  Icon.Top = (iTop-c1)-Icon.Height 
End Function

Function btn1_onclick()
  Call Hesapla("1")     'btn1
End Function

Function btn2_onclick()
    Call Hesapla("2")     'btn2
End Function