Creation of a "Custom" Object

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Creation of a "Custom" Object

Post 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 "hmg.ch"
#include "hbclass.ch"
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 "hbclass.ch" 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 "hbclass.ch" 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
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Creation of a "Custom" Object

Post by danielmaximiliano »

Hi Red2

See http://www.kresin.ru/en/hrbfaq_3.html chapter 3.3

Code: Select all

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

      [HIDDEN:]
         [ 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,...>] ) ]
         ...
      [PROTECTED:]
         ...
      [VISIBLE:]
      [EXPORTED:]
         ...

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

      [SYNC METHOD <cSyncMethod>]

      ENDCLASS [ LOCK | LOCKED ]
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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: Creation of a "Custom" Object

Post by IMATECH »

OOP Sample !
Take a look here: viewtopic.php?f=35&t=2513&p=22112
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Creation of a "Custom" Object

Post by Anand »

Hi Red2

My Report Class is based on custom class object.
viewtopic.php?p=51251#p51251

You can check the source, if it helps.

Regards,

Anand
Regards,

Anand

Image
Red2
Posts: 271
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Creation of a "Custom" Object

Post 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
Post Reply