PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Import a Class from Text??
Import a Class from Text??
Iniciado por CCordes, 06,ago. 2016 20:11 - 2 respuestas
Miembro registrado
68 mensajes
Publicado el 06,agosto 2016 - 20:11
Is there a way to include a class written in a text file in a WD project?

I'd like to move a whole batch of procedures that have into a class without having to manually add each one separately.
I need to do some code cleanup as well and it would go easily if I could work in TextPad or UltraEdit and then 'import' the text into WD.

I tried to do it quickly in the 'Simple OOP' Example by copying the Elephant Class to textpd, changing it to ElephantSeal and then adding it back as External source - EXTERN "ClassTestElephantSeal.WL"
Unfortunately, EXTERN is not allowed in the class declarations, and the parent class isn't available in project global section.

I hope I'm just missing something or that someone can definitively say that this is just not possible.

Thanks!
Chris C

--
Sometimes waiting is the best way forward...
Publicado el 08,agosto 2016 - 14:34
Hi Chris,

AFAIK, it's not possible (and requested by many users for a long time)

However, you CAN copy multiple procedures into a class in one go... Just
multiselect the procedures, copy and paste... that part DOES work

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com

Le 8/6/2016 à 12:11 PM, Chris CORDES a écrit :
Is there a way to include a class written in a text file in a WD project?

I'd like to move a whole batch of procedures that have into a class
without having to manually add each one separately.
I need to do some code cleanup as well and it would go easily if I could
work in TextPad or UltraEdit and then 'import' the text into WD.

I tried to do it quickly in the 'Simple OOP' Example by copying the
Elephant Class to textpd, changing it to ElephantSeal and then adding it
back as External source - EXTERN "ClassTestElephantSeal.WL"
Unfortunately, EXTERN is not allowed in the class declarations, and the
parent class isn't available in project global section.

I hope I'm just missing something or that someone can definitively say
that this is just not possible.

Thanks!
Chris C

--
Sometimes waiting is the best way forward...
Miembro registrado
68 mensajes
Publicado el 08,agosto 2016 - 21:41
Thanks, Fabrice. I was afraid that was the answer. Just hoping to use a better text editor on the whole batch more easily.
Here is what I found though -
I can copy the whole batch into a Class declaration, and then for each Method, I can comment out the declaration line, copy the method code, right click New method from selected code, give it name. Once it is in, I uncomment the declaration and delete the new one.

--
Sometimes waiting is the best way forward...