Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 14 total |
Getting the first line of ftWideMemo field in a Unicode database |
Mon, Feb 10 2014 8:51 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | Hi
In an AfterScroll event I'm calling a procedure to display the first line of the memo in the status bar of a form. Unsuccessfully. Rather than try an explain I have pasted the code below with heaps of comments. This method worked in DBISAM3, but I'm going wrong with ElevateDB Unicode (and slowly going round the bend!). Cheers Jeff ---------------------------------------------------------------------- procedure TmainForm.LandlordWarning; { mainStatusBar is a TStatusBar scrLandlords is a script and this procedure is called on its AfterScroll event The script is the DataSource of a TDBGrid slWarning is is created in FormCreate:- slWarning := TStringList.Create; apmDM.LandlordLookUp points to the "Landlords" table apmDM.LandlordLookUpInternalComment is a TMemo field with BlobType = ftWideMemo "InternalComment" CLOB COLLATE "UNI", "InternalCommentIsWarning" BOOLEAN DEFAULT False, } begin mainStatusBar.SimplePanel := True; if scrLandlordsInternalCommentIsWarning.AsBoolean then { then we want to display the first line of the InternalComment memo field in the form's status bar} begin mainStatusBar.SimplePanel := True; mainStatusBar.Font.Style := mainStatusBar.Font.Style + [fsBold]; mainStatusBar.Color := clRed; apmDM.OpenTable(apmDM.LandlordLookUp); // opens table if not already open if apmDM.LandlordLookUp.Locate('LandlordCode', scrLandlordsLandlordCode.AsVariant, []) then begin {Various attempts to make this work - worked in DBISAM3 but here I just get a single character - the first one in the memo. Displaying the InternalComment in a TDBMemo works correctly} // slWarning.Text := apmDM.LandlordLookUpInternalComment.AsWideString; // slWarning.Assign(apmDM.LandlordLookUpInternalComment); // slWarning.Text := apmDM.LandlordLookUpInternalComment.AsString; mainStatusBar.SimpleText := 'WARNING - '; if slWarning.Count > 0 then mainStatusBar.SimpleText := mainStatusBar.SimpleText + slWarning[0]; end; end else begin mainStatusBar.Font.Style := mainStatusBar.Font.Style - [fsBold]; mainStatusBar.Color := clBtnFace; mainStatusBar.SimpleText := ''; end; end; |
Tue, Feb 11 2014 9:53 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Jeff,
<< Rather than try an explain I have pasted the code below with heaps of comments. This method worked in DBISAM3, but I'm going wrong with ElevateDB Unicode (and slowly going round the bend!). >> What version of Delphi are you using ? Tim Young Elevate Software www.elevatesoft.com |
Tue, Feb 11 2014 3:10 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | Sorry - should know better - Delphi XE and ElevateDB 2.14 B2.
-- Jeff Cook Aspect Systems Ltd www.aspect.co.nz "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:A50EE546-D8A0-43B8-9F8E-2AF3D3721250@news.elevatesoft.com... > Jeff, > > << Rather than try an explain I have pasted the code below with heaps of > comments. This method worked in DBISAM3, but I'm going wrong with > ElevateDB Unicode (and slowly going round the bend!). >> > > What version of Delphi are you using ? > > Tim Young > Elevate Software > www.elevatesoft.com |
Tue, Feb 11 2014 11:14 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | In my sample code
> mainStatusBar is a TStatusBar is an untruth! It is actually a TStatusBarPro which is an enhanced version of TStatusBar. However, I have retested by creating a TLabel and done "Label1.Caption := slWarning[0];" and getting the same one character result. -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz |
Wed, Feb 12 2014 11:30 AM | Permanent Link |
Barry | Jeff,
What happens when you assign it to a local String variable and examine it in the debugger? Barry |
Wed, Feb 12 2014 2:57 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Jeff,
<< Sorry - should know better - Delphi XE and ElevateDB 2.14 B2. >> What type of class is LandlordLookUpInternalComment declared as in your form/data module ? Tim Young Elevate Software www.elevatesoft.com |
Wed, Feb 12 2014 3:19 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | Hi Barry
var s: string; OR var s:AnsiString: s := apmDM.LandlordLookUpInternalComment.AsString; OR apmDM.LandlordLookUpInternalComment.AsWideString; In any combination all give the same value for s in the debugger 'C'#0'l'#0'i'#0'c'#0'k'#0' '#0't'#0'h'#0'e'#0' '#0'D'#0'e'#0't'#0'a'#0'i'#0'l'#0's'#0' '#0'b'#0'u'#0't'#0't'#0'o'#0'n'#0' '#0'f'#0'o'#0'r'#0' '#0't'#0'h'#0'e'#0' '#0'p'#0'u'#0'r'#0'p'#0'o'#0's'#0'e'#0' '#0'o'#0'f'#0' '#0't'#0'h'#0'i'#0's'#0' etc. -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz <Barry> wrote in message news:A1DB281E-948E-481D-A45A-4A908FEB6203@news.elevatesoft.com... > Jeff, > > What happens when you assign it to a local String variable and examine it > in the debugger? |
Wed, Feb 12 2014 3:49 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:59F758B5-6C0C-466B-8BC8-F9B53651F3B4@news.elevatesoft.com... > Jeff, > > What type of class is LandlordLookUpInternalComment declared as in your > form/data module ? > object LandlordLookUpInternalComment: TMemoField FieldName = 'InternalComment' Origin = 'Landlords.InternalComment' BlobType = ftWideMemo end .... so I'm guessing that TMemoField is the problem. (Have no Delphi Help at present - it periodically goes AWOL with a message "RAD Studio's help namespace is not defined. Please reinstall RAD Studio's documentation.") So experiment with TWideMemoField - is there such a thing? YES! And it works. Thanks Tim and Barry. Another bulk replace coming up - all TMemoFields become TWideMemoFields. Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz |
Thu, Feb 13 2014 2:51 AM | Permanent Link |
Barry | "Jeff Cook" wrote:
Hi Barry >var s: string; OR var s:AnsiString:< ???? Why are you using AnsiString (8 bit characters) when you are using EDB Unicode which is 16 bit character? I assume you are using the Unicode version of ElevateDb because your collation is "UNI". You should forget about Ansi altogether when using EDB Unicode with Delphi XE. Just use String variables with XE which is 16 bit Unicode. >In any combination all give the same value for s in the debugger 'C'#0'l'#0'i'#0'c'#0'k'#0' '#0't'#0'h'#0'e'#0' '#0'D'#0'e'#0't'#0'a'#0'i'#0'l'#0's'#0' '#0'b'#0'u'#0't'#0't'#0'o'#0'n'#0' '#0'f'#0'o'#0'r'#0' '#0't'#0'h'#0'e'#0' '#0'p'#0'u'#0'r'#0'p'#0'o'#0's'#0'e'#0' '#0'o'#0'f'#0' '#0't'#0'h'#0'i'#0's'#0' < That's because ElevateDb is returning Unicode (16 bit) and it appears your strings are 8 bit ANSI so you are getting the extra #0 as an extra character. I don't know why your "var s: String" failed, unless you have XE set to ANSI strings instead of the default Unicode strings? Did you mess around with any compiler directives or environment settings to get XE to use ANSI strings? If so, you need to revert back to the default Unicode for XE. Barry |
Thu, Feb 13 2014 2:58 AM | Permanent Link |
Barry | >>
.... so I'm guessing that TMemoField is the problem. (Have no Delphi Help at present - it periodically goes AWOL with a message "RAD Studio's help namespace is not defined. Please reinstall RAD Studio's documentation.") So experiment with TWideMemoField - is there such a thing? YES! And it works. Thanks Tim and Barry. Another bulk replace coming up - all TMemoFields become TWideMemoFields.<< If you read my previous message, then you shouldn't have to use TWideMemoFields if XE is set to Unicode. Only if you are using an ANSI environment, do you need to specify "WIde" because with Unicode everything is be wide by default. Once you get XE to use Unicode as the default, you really only need to use the common String or TMemoField because they are already wide. Barry |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 14, 2024 at 07:14 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |