Page 1 of 1 1
Topic Options
#213731 - 2019-07-13 07:46 AM Play with object
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 81
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.

 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.


Attachments
classKiX.kix (21 downloads)
Description:



Top
#213732 - 2019-07-14 06:51 PM Re: Play with object [Re: AndreLuiz]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4483
Loc: USA
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.

Top
#213733 - 2019-07-14 08:14 PM Re: Play with object [Re: Allen]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 81
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
#213734 - 2019-07-15 04:56 AM Re: Play with object [Re: AndreLuiz]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4483
Loc: USA
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.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 42 anonymous users online.
Newest Members
GBMicros, Jodey, Hiker, GTRoberts, KatieQuinn
17685 Registered Users

Generated in 0.03 seconds in which 0.012 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org