#213731 - 2019-07-13 07:46 AM
Play with object
|
AndreLuiz
Getting the hang of it
Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
|
[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.
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.
Attachments
classKiX.kix (250 downloads) Description:
|
Top
|
|
|
|
#213733 - 2019-07-14 08:14 PM
Re: Play with object
[Re: Allen]
|
AndreLuiz
Getting the hang of it
Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
|
[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?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 557 anonymous users online.
|
|
|