Implementing a memo field into a form
Moderator: Rathinagiri
Implementing a memo field into a form
Dear HMG mentor
To implement a memo .dbt file into a form, must I use an EDITBOX as the control?
When I specify a field as type memo do I write for example "MyNotes,m " or is there more setup parameters like "MyNotes,m,10,5"
Finally, can I be directed to the best tutorial example.
Thanks
To implement a memo .dbt file into a form, must I use an EDITBOX as the control?
When I specify a field as type memo do I write for example "MyNotes,m " or is there more setup parameters like "MyNotes,m,10,5"
Finally, can I be directed to the best tutorial example.
Thanks
- serge_girard
- Posts: 3161
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Implementing a memo field into a form
Hi Bluebird,
I would recomment TEXTBOX for memo IF the textlen is limited to 1 line ELSE use EDITBOX. See SAMPLES TEXBOX and SAMPLES EDITBOX.
Regards, Serge
I would recomment TEXTBOX for memo IF the textlen is limited to 1 line ELSE use EDITBOX. See SAMPLES TEXBOX and SAMPLES EDITBOX.
Regards, Serge
There's nothing you can do that can't be done...
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Implementing a memo field into a form
For Memo fields you will read field and assign a variable.
You don't use "MyNotes,m " (this comma) inside a string doesn't any thing.
For reading and assigning you make like this:
Then you define your EditBox in VALUE property with cText
I have a good reason in my experience to avoid MEMO fields into DBFs. Instead, I create individual text files stored into a special subfolder and each names of text files be compoused by any code from dbf's field . Example:
You don't use "MyNotes,m " (this comma) inside a string doesn't any thing.
For reading and assigning you make like this:
Code: Select all
cText:=hb_MemoRead("MyNotes") // supposed to be this name for memo field
I have a good reason in my experience to avoid MEMO fields into DBFs. Instead, I create individual text files stored into a special subfolder and each names of text files be compoused by any code from dbf's field . Example:
Code: Select all
cNum:=StrZero((dbf->Client_cod),8,0)
cFile:="Note_"+cNum+".txt"
cFolder:=cFilePath(GetProgramFileName())+"\Notes" // subfolder named Notes
hb_MemoWrit(cFolder+"\"+cFile,"Here's your text to be saved")
Finally, my contribution to your questions only found at moment is to download Stru and locate for Function Stru_Process()
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Implementing a memo field into a form
Thank you all for the help
I downloaded the STRUcture utility and recorder the following line.
Please tell me what the last two entries in the structure of the memo field mean, i.e.. the 010 and the 000?
I threw away my Clipper manuals 20 years ago, which was a mistake because HMG renewed my interest.
+--------- PLINFO.DBF ----------+
| Nr Name Type Siz Dec |
+-------------------------------+
| 01 "CODE" ,"C",004,000 |
| 02 "NAME" ,"C",040,000 |
| 03 "TYPE" ,"C",040,000 |
| 04 "ACCOUNT" ,"C",040,000 |
| 05 "LOGONID" ,"C",015,000 |
| 06 "PASSWORD" ,"C",015,000 |
| 07 "URL" ,"C",030,000 |
| 08 "PHONE" ,"C",013,000 |
| 09 "EMAIL" ,"C",040,000 |
| 10 "NOTES" ,"M",010,000 | < My memo field **
+------ Total records 29 -------+
I downloaded the STRUcture utility and recorder the following line.
Please tell me what the last two entries in the structure of the memo field mean, i.e.. the 010 and the 000?
I threw away my Clipper manuals 20 years ago, which was a mistake because HMG renewed my interest.
+--------- PLINFO.DBF ----------+
| Nr Name Type Siz Dec |
+-------------------------------+
| 01 "CODE" ,"C",004,000 |
| 02 "NAME" ,"C",040,000 |
| 03 "TYPE" ,"C",040,000 |
| 04 "ACCOUNT" ,"C",040,000 |
| 05 "LOGONID" ,"C",015,000 |
| 06 "PASSWORD" ,"C",015,000 |
| 07 "URL" ,"C",030,000 |
| 08 "PHONE" ,"C",013,000 |
| 09 "EMAIL" ,"C",040,000 |
| 10 "NOTES" ,"M",010,000 | < My memo field **
+------ Total records 29 -------+
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Implementing a memo field into a form
010 field size 000 is decimal field. Both are not stricted for fill up. Memo field accept text, string. Not need to define limit of size/decimal.
What's you mean is Harbour not HMG. Who's really treats DBF is Harbour. All you know in Clipper you reuse in Harbour 100%.
Graphical controls like as EditBox is with HMG.
Stru is not the best example to see Memo fields. Sorry, I was wrong indicated. I thought for EditBox treatment.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Implementing a memo field into a form
Hi bluebird,
"NOTES" ,"M",010,000 in the dbf structure list imples that the dbf file has a "Memo" field. The actual data text of the memo field is stored in a separate .DBT file (for Clipper). The memo field in the dbf stores the file pointer in the DBT file of the text.
When you assign the memo field to a variable, it gets the text from the DBT file.
xVar := file->MEMO1
Now xVar has the text value.
The length of the text which can be stored in the MEMO field is unlimited (i.e. DBT file) and is stored in chunk of 512 in Clipper.
If the corresponding DBT file is missing or deleted, then you can not open the DBF file. So you must ensure to copy DBF and DBT file for backup or sync etc. purpose.
Regards,
Anand
"NOTES" ,"M",010,000 in the dbf structure list imples that the dbf file has a "Memo" field. The actual data text of the memo field is stored in a separate .DBT file (for Clipper). The memo field in the dbf stores the file pointer in the DBT file of the text.
When you assign the memo field to a variable, it gets the text from the DBT file.
xVar := file->MEMO1
Now xVar has the text value.
The length of the text which can be stored in the MEMO field is unlimited (i.e. DBT file) and is stored in chunk of 512 in Clipper.
If the corresponding DBT file is missing or deleted, then you can not open the DBF file. So you must ensure to copy DBF and DBT file for backup or sync etc. purpose.
Regards,
Anand
- serge_girard
- Posts: 3161
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Implementing a memo field into a form
Hi,
And I think that '10' in "NOTES" ,"M",010,000 in the dbf structure is ignored.
Gives all the same result... At least in my DBF viewer!
Serge
And I think that '10' in "NOTES" ,"M",010,000 in the dbf structure is ignored.
Code: Select all
AADD(aDBF, { "M1", "M", 10, 0 })
AADD(aDBF, { "M2", "M", 0, 0 })
AADD(aDBF, { "M3", "M", 1 , 0 })
AADD(aDBF, { "M4", "M", 100, 0 })
Gives all the same result... At least in my DBF viewer!
Serge
There's nothing you can do that can't be done...
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: Implementing a memo field into a form
Yes, this info is correct, Serge.serge_girard wrote:And I think that '10' in "NOTES" ,"M",010,000 in the dbf structure is ignored.Pablo César wrote: ↑Thu Jan 19, 2017 5:14 pm 010 field size 000 is decimal field. Both are not stricted for fill up. Memo field accept text, string. Not need to define limit of size/decimal.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Implementing a memo field into a form
Thanks for all replies.
Continuing with my Memo field problem
My application works except that I cannot save the memo composed in the EDITBOX control named T_Notes
The field name in my DBF is "Names,m".
Looking at the code that attempts to save PLInfo_>Notes, I get a context error only on those lines that contain T_Notes (see asterisks)
Do I have to save that field in a different way to other fields ?
The HMG examples do not seem to save memos. Do I have to use
the old Clipper MEMOEDIT commands. Its been 20 years since using it so I've forgotten how.
If lNew // is this a new record
PLInfo->(DBSetOrder(1))
PLInfo->(DBGoBottom())
WebCode := StrZero( Val( PLInfo->Code ) + 1 , 4 )
PLInfo->(DBAppend())
PLInfo->Code := WebCode
PLInfo->Name := Form_2.T_Name.Value
PLInfo->Type := Form_2.T_Type.Value
PLInfo->PassWord := Form_2.T_PassWord.Value //new PW is undisguised
PLInfo->LogOnID := Form_2.T_LogOnID.Value
PLInfo->Account := Form_2.T_Account.Value
PLInfo->URL := Form_2.T_URL.Value
PLInfo->Phone := Form_2.T_Phone.Value
PLInfo->EMail := Form_2.T_Email .Value
PLInfo->Notes := Form_Memo.T_Notes.Value **********************< Context Error
Else
cCode := Form_2.T_Code.Value
PLInfo->(DBSetOrder(1))
If ! PLInfo->(DBSeek( cCode ))
MsgSTOP("Registration "+cCode+" not located!!","PLInfo")
Release Window ALL
EndIf**********************< Context Error
If BlockRegistrationOnNetwork( "PLInfo" )
PLInfo->Name := Form_2.T_Name.Value
PLInfo->Type := Form_2.T_Type.Value
PLInfo->PassWord := PWDisguise(Form_2.T_PassWord.Value) //undo PW disguise
PLInfo->LogOnID := Form_2.T_LogOnID.Value
PLInfo->Account := Form_2.T_Account.Value
PLInfo->URL := Form_2.T_URL.Value
PLInfo->Phone := Form_2.T_Phone.Value
PLInfo->EMail := Form_2.T_Email.Value
PLInfo->Notes := Form_Memo.T_Notes.Value **********************< Context Error
PLInfo->(DBUnlock())
EndIf
EndIf
MsgInfo( "Information "+Iif( lNew , "Registered" ,"Altered!!" ) )
PosicionaIndice( Left( PLInfo->Name , 1 ) )
Research_PLInfo()
Form_2.Release
Return Nil
Continuing with my Memo field problem
My application works except that I cannot save the memo composed in the EDITBOX control named T_Notes
The field name in my DBF is "Names,m".
Looking at the code that attempts to save PLInfo_>Notes, I get a context error only on those lines that contain T_Notes (see asterisks)
Do I have to save that field in a different way to other fields ?
The HMG examples do not seem to save memos. Do I have to use
the old Clipper MEMOEDIT commands. Its been 20 years since using it so I've forgotten how.
If lNew // is this a new record
PLInfo->(DBSetOrder(1))
PLInfo->(DBGoBottom())
WebCode := StrZero( Val( PLInfo->Code ) + 1 , 4 )
PLInfo->(DBAppend())
PLInfo->Code := WebCode
PLInfo->Name := Form_2.T_Name.Value
PLInfo->Type := Form_2.T_Type.Value
PLInfo->PassWord := Form_2.T_PassWord.Value //new PW is undisguised
PLInfo->LogOnID := Form_2.T_LogOnID.Value
PLInfo->Account := Form_2.T_Account.Value
PLInfo->URL := Form_2.T_URL.Value
PLInfo->Phone := Form_2.T_Phone.Value
PLInfo->EMail := Form_2.T_Email .Value
PLInfo->Notes := Form_Memo.T_Notes.Value **********************< Context Error
Else
cCode := Form_2.T_Code.Value
PLInfo->(DBSetOrder(1))
If ! PLInfo->(DBSeek( cCode ))
MsgSTOP("Registration "+cCode+" not located!!","PLInfo")
Release Window ALL
EndIf**********************< Context Error
If BlockRegistrationOnNetwork( "PLInfo" )
PLInfo->Name := Form_2.T_Name.Value
PLInfo->Type := Form_2.T_Type.Value
PLInfo->PassWord := PWDisguise(Form_2.T_PassWord.Value) //undo PW disguise
PLInfo->LogOnID := Form_2.T_LogOnID.Value
PLInfo->Account := Form_2.T_Account.Value
PLInfo->URL := Form_2.T_URL.Value
PLInfo->Phone := Form_2.T_Phone.Value
PLInfo->EMail := Form_2.T_Email.Value
PLInfo->Notes := Form_Memo.T_Notes.Value **********************< Context Error
PLInfo->(DBUnlock())
EndIf
EndIf
MsgInfo( "Information "+Iif( lNew , "Registered" ,"Altered!!" ) )
PosicionaIndice( Left( PLInfo->Name , 1 ) )
Research_PLInfo()
Form_2.Release
Return Nil
Re: Implementing a memo field into a form
Note to all responders on this subject.
I apologize if I have taken too much of your time. For some reason the code above now compiles error free. I do not know what I did
to make it work. Its a frustration to see an "context" error when the line of code agrees with the HMG description but still does not work.
Thanks to all
I apologize if I have taken too much of your time. For some reason the code above now compiles error free. I do not know what I did
to make it work. Its a frustration to see an "context" error when the line of code agrees with the HMG description but still does not work.
Thanks to all