Creation of a "Custom" Object

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Red2
Posts: 44
Joined: Sat May 18, 2019 2:11 pm
DBs Used: DBF, FoxPro, Visual FoxPro
Location: United States (East Coast)
Has thanked: 13 times
Been thanked: 2 times

Creation of a "Custom" Object

Post by Red2 » Sun Aug 11, 2019 11:09 pm

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: 2166
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 177 times
Been thanked: 26 times
Contact:

Post by danielmaximiliano » Mon Aug 12, 2019 12:33 am

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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
IMATECH
Posts: 174
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.
Has thanked: 1 time
Been thanked: 3 times

Post by IMATECH » Mon Aug 12, 2019 4:10 am

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

By: IMATECH

Imation Tecnologia

User avatar
Anand
Posts: 424
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 122 times
Been thanked: 60 times

Post by Anand » Mon Aug 12, 2019 9:47 am

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
Image

Red2
Posts: 44
Joined: Sat May 18, 2019 2:11 pm
DBs Used: DBF, FoxPro, Visual FoxPro
Location: United States (East Coast)
Has thanked: 13 times
Been thanked: 2 times

Post by Red2 » Tue Aug 13, 2019 1:06 am

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