|
|
|||||||
[pt-br] Bem gente não esperem um código organizado aqui, mas tive essa ideia e corri para vir trazer pra vocês darem uma olhada. Ainda está aprender a engatinhar, mas com um pouco mais de tempo ficaria legal!! A ideia aqui é uma forma de criar uma classe em kixtart usando VBscript. Como disse a ideia está aprendendo a andar, mas se eu tivesse tempo para traduzir um código kixtart para um equivalente em vbs ficaria simplesmente "perfeito". Bem vejam o código e testem. [eng(google translator)] Well people do not expect an organized code here, but I had this idea and I ran to come and bring you guys a look. Still learning to crawl, but with a little more time it would be cool !! The idea here is a way to create a class in kixtart using VBscript. As I said the idea is learning to walk, but if I had time to translate a kixtart code to an equivalent in vbs would just be "perfect". Well, look at the code and test it. PHP:
Break on
$pen = NewClass('pen',
Myclass_pen('prop'), ;;INCLUDE PROPERTYS
Myclass_pen('methods') ;;INCLUDE METHODS
)
$pen.color = "red"
$pen.point = 1.5
$pen.Setcap(0)
"$$pen.cap (private):" $pen.Getcap()?
"Type : " VarTypeName($pen.Getcap())?
"-----------"?
"$$pen.color : "$pen.color?
"Type : " VarTypeName($pen.color)?
"$$pen.point : "$pen.point?
"Type : " VarTypeName($pen.point)?
get$
function Myclass_pen($request)
if ($request = "prop")
$Myclass_pen =
"private", "cap",
"public", "point",
"public", "color"
else if ($request = "methods")
$Myclass_pen =
'
sub Setcap(value)
cap = Cbool(value)
end sub
function Getcap()
Getcap = Cbool(cap)
end function
'
endif endif
endfunction
function NewClass($name, $prop, $methods)
$script = "class " + $name + @crlf + @crlf
for $i=0 to ubound($prop) step 2
$script = $script + $prop[$i]+" "+$prop[$i+1]+@crlf
next
if (ubound($methods) = -1)
$script = $script + $methods + @crlf + @crlf
else
for $i=0 to ubound($methods)
$script = $script + $methods[$i] + @crlf + @crlf
next
endif
$script = @crlf+$script + "end class"
$sc = CreateObject("ScriptControl")
$sc.Language = "VBScript"
$sc.addcode($script)
$NewClass = $sc.Eval("new "+$name)
endfunction
[pt-br] Bem já estou criando um RegEx para fazer a tradução do código KiXtart para um equivalente Vbs. [eng(google translator)] Well I'm already creating a RegEx to do the translation of the KiXtart code to a Vbs equivalent. |
||||||||
|
|
|||||||
I used something similar a few years ago. There is a limit to the amount of classes you can add. If I remember correctly, the limit was 225. For most things this works fine, but for what I was working on it would not have helped. Cool to see someone else trying to use it. |
||||||||
|
|
|||||||
[PT-BR] É bem, mas para algo pequeno seria legal ter um poo em KiXtart, e é melhor 225 classes do que 0 classes. Mas muito obrigado por dado uma olhada no meu post. Ah, você conhece algum forma de usar regex em KiXtart? [ENG(GOOGLE TRANSLATE)] That's fine, but for something small it would be nice to have a poo in KiXtart, and 225 classes are better than 0 classes. But thank you very much for taking a look at my post. Oh, do you know any way to use regex in KiXtart? |
||||||||
|
|
|||||||
I did a quick search and the first link I clicked on was ME, asking the same question. LOL. I had completely forgotten that. http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=175125#Post175125 The links in my question point to a few UDFs that might be useful. |