Page 1 of 1

Creation of a "Custom" Object

Posted: Sun Aug 11, 2019 11:09 pm
by Red2
Hello All,

I am still rather new to HMG. HMG has some really GREAT capabilities but they seem to be absent from the help file.

For example, a custom object could be very helpful in my current project. In a forum post, (viewtopic.php?f=5&t=4511&p=43036&hilit=HBClass#p43036), I saw some simple code I have adapted (below).

Code: Select all

#include ""
#include ""
public oMyObj
oMyObj := CreateNewObj()

class CreateNewObj
	data ReadOnly	AS	character	INIT "ReadOnly"
	data Hidden	as	character	init "Hidden"
end class
Unfortunately I have not found documentation on HMG's implementation of "" and CLASS ... END CLASS to help me.

My Question:
1) Can HMG assign a "Value" property to each such that the following will be valid? oMyObj:ReadOnly:Value and oMyObj:Hidden:Value
2) Where might I find good references that might explain or document the use of "" and CLASS ... END CLASS in HMG?
3) Also, are there better or other ways to create and manipulate a custom object?

Any help you would be kind enough to point me to would be greatly appreciated!

Thank you, Red2

Re: Creation of a "Custom" Object

Posted: Mon Aug 12, 2019 12:33 am
by danielmaximiliano
Hi Red2

See chapter 3.3

Code: Select all

[CREATE] CLASS <cClassName> [ FROM | INHERIT <cSuperClass1> [, ... ,<cSuperClassN>] ]
                [ MODULE FRIENDLY ] [ STATIC ] [ FUNCTION <cFuncName> ]

         [ CLASSDATA | CLASSVAR  | CLASS VAR <DataName1>]
         [ DATA | VAR  <DataName1> [,<DataNameN>] [ AS <type> ] [ INIT <uValue> ]
                [[EXPORTED | VISIBLE] | [PROTECTED] | [HIDDEN]] [READONLY | RO] ]
         [ METHOD <MethodName>( [<params,...>] ) [CONSTRUCTOR] ]
         [ METHOD <MethodName>( [<params,...>] ) INLINE <Code,...> ]
         [ METHOD <MethodName>( [<params,...>] ) BLOCK  <CodeBlock> ]
         [ METHOD <MethodName>( [<params,...>] ) EXTERN <funcName>([<args,...>]) ]
         [ METHOD <MethodName>( [<params,...>] ) SETGET ]
         [ METHOD <MethodName>( [<params,...>] ) VIRTUAL ]
         [ METHOD <MethodName>( [<params,...>] ) OPERATOR <op> ]
         [ ERROR HANDLER <MethodName>( [<params,...>] ) ]
         [ ON ERROR <MethodName>( [<params,...>] ) ]

      [FRIEND CLASS <ClassName,...>]
      [FRIEND FUNCTION <FuncName,...>]

      [SYNC METHOD <cSyncMethod>]

PD: If we talk about HMG we are on the graphical part in Windows environment. if we talk about the programming language we are talking about Harbour

Re: Creation of a "Custom" Object

Posted: Mon Aug 12, 2019 4:10 am
OOP Sample !
Take a look here: viewtopic.php?f=35&t=2513&p=22112

Re: Creation of a "Custom" Object

Posted: Mon Aug 12, 2019 9:47 am
by Anand
Hi Red2

My Report Class is based on custom class object.

You can check the source, if it helps.



Re: Creation of a "Custom" Object

Posted: Tue Aug 13, 2019 1:06 am
by Red2
Thank you all for your very generous help and suggestions. I really appreciate it.

Something has come up and I will not be able to dig into this for a week or two but I will then.

Thanks again! Red2