Classes tutorial to create a class from scratch

Dear Julian: the example was perfect that I started migrating my templates which I created only for calling functions and I will use them later as classes.

Thank you

Dear Mark:
thank for providing the 6.3 version but I unfortunately got some errors:

thank you again

Hi,

Did you clone the repository or just copy the app file?

The app file requires MyFunctionClass.inc and .clw

Unfortunately I am not getting the errors you are.

Mark

Hello
I extracted all the file in one folder after downloading.

Here is what I downloaded
ClarionClassExample-main (1).zip (3.3 MB)

Best Regards

Iā€™m pleased my example helped, moving forwards, if you create your own inc/clw pair of files for your own class and need to ask more questions in the future then itā€™ll be sufficient to pose your question and attach just the two files, you wonā€™t need to attach a full app or project because the people that frequent this forum have significant expertise an may suggest a solution from those alone (without needing to revert to C6).

Hi,

Well this was a Me fault. I had expected you to clone the repository rather than get the zip.

I hadnā€™t added details to .gitattributes to make sure CRLF (Windows line endings) were stored correctly.

When you clone, this isnā€™t an issue, but when you get the ZIP the files will just have LF for the line endings.

Iā€™ve updated the repository, if you download the zip again, fingers crossed, everything should work this time.

Sorry about that.

Mark

Thank you so much.

Best Regards

Same thing :frowning_face:

But after that I opened the .clw and .inc from Clarion IDE and saved them again everything went smooth :grinning:

Thanks a lot
Best Regards

The below two GitHub Repos contain a Class that has a single purpose and are stand alone i.e. do not need ABC. They also include a Program to test that Class which shows you how to add it to a program ā€¦ which is just an INCLUDE('class.inc'),ONCE in Global.

They do not use LINK(, _L_) / DLL(_D_) flags so the Class is always compiled in. This keeps it simple and is the best way to start. Once you have those Flags you must have them in your Project Defines correctly or your program will crash.


Further on making Classes ā€¦ My tool Do2Class will take a Legacy Procedure with ROUTINEā€™s and change them all to be PROCEDUREā€™s in a local CLASS. I usually name that class ā€œDOOā€, but it can be named anything. The docs in the Read Me discuss several issues with using a CLASS instead of a ROUTINE.

The way it works is you export the Procedure to a TXA. Do2Class makes all its changes and writes a new TXA for you to import. If you didnā€™t like the results you can import the Original TXA to undo the changes. So its very safe. The Class advantage is you can pass parameters and get return values. There are links to CIDC webinars on it and classes in the Read Me.


If you use StringTheory this Repo has a Big Bang Theory ā€œHelperā€ class that is fairly simple.

2 Likes

Sorry I was away for a while.

I will check these.

Thank you and regards