NextGrid.Footer.FormatMask does not work correctly
#1
Posted 12 February 2007 - 08:30 AM
If we put format mask for nextgrid footer, it does not work as required. For example, I put ###,###,###,### in the Footer.FormatMask in the Column Salary of Demo1, if the column footer has no data, it show , , , and if the footer is right-aligned, it always show xxx,xxx,...
Regards,
#2
Posted 13 February 2007 - 01:18 AM
I suggest reading topic FormatMaskText function in Delphi help.
You will find formating rules there. Footer accept other characters than number and I have need to use this function
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 27 February 2007 - 09:23 AM
I suggest reading topic FormatMaskText function in Delphi help.
You will find formating rules there. Footer accept other characters than number and I have need to use this function
regards
Thank you Borki,
In my case, the data in column and footer are numbers so I just remove format mask of the footer and it works well. Anyway I think you need to check why it show xxx,xxx,... if we put format mask for the footer and make the footer right-align.
Regards
#4
Posted 20 June 2007 - 06:26 AM
If I put format mask (#,##0) for the footer and make the footer right-align, the value is displayed quite far from right margin.
Regards
#5
Posted 20 June 2007 - 07:58 AM
Unfortunatelly, this is all to do with FormatMaskText function of Delphi, because I simply transfer string to FormatMaskText and TextOut values on screen. I have read that FormatMaskText have some bugs and limitations.
If you have any suggestion, this may help me. Maybe adding property MaskKind (mkAlpha, mkNumeric) will help. As you may see, FormatMask for TNxNumberColumn work very well with numbers.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#6
Posted 20 June 2007 - 03:23 PM
The mask works well but I think the problem is on displaying the formated value. You can check that if I do not put mask for footer, the masked value is displayed correctly (right align). But if I do it, the masked value is far away from the right margin.
#7
Posted 20 June 2007 - 03:27 PM
I think that mask create this 2 blank spaces and then draw it. This made this extra space.
Try to:
1) add one TLabel
- set AutoSize to false,
- set Color to clYellow
- and Alignment to taRightJustify.
2) add one TButton and
- in OnClick add
You will see 2 blank spaces at the end.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#8
Posted 21 June 2007 - 06:20 AM
I think the root of the problem is you design the footer can contain characters so you use FormatMaskText to appy mask format and the behaviour of this function is different from what we expected, e.g the DisplayFormat of a persistent field. So we have to accept this.
In your example if we put the mask like this FormatMaskText('#,##0;0', '1300345'), there will be no redundent space but that is not we expect.
Regards
#9
Posted 21 June 2007 - 06:24 AM
Hello Boki,
It is the best if you can do this.
Regards
#10
Posted 21 June 2007 - 12:16 PM
Can you please tell me how do you want to have number formated. I will try to find appropriate mask string for you.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#11
Posted 21 June 2007 - 01:21 PM
Can you please tell me how do you want to have number formated. I will try to find appropriate mask string for you.
regards
Hello Boki,
I like it works same as DisplayFormat of a TBCDField (you can create a persistent field to see that property). As I said in the last post, for a numeric value, I don't put mask for it and it can get the mask of the column.
Regards
#12
Posted 21 June 2007 - 02:01 PM
This format (FormatFloat function from Delphi) I am using for NxNumberColumn too, but this work when data type is only number. But in Footer.Caption and other characters may be stored This is why I use FormatMaskText function there.
Maybe you can use FormatFloat directly, before writing into Footer.Caption?
I have think and maybe MaskKind property is not good idea , but maybe I may add FormulaMask (string) because Formulas are allways numbers.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#13
Posted 22 June 2007 - 01:06 PM
I am sorry to say that I don't need it indeed. I just report you the strange behaviour of the result string in the footer if we put mask string for it. As I said serveral times before, the mask of the column also works for the footer so I have no idea if you drop the mask of the footer.
Regards
#14
Posted 22 June 2007 - 01:10 PM
For number columns there is no problems thanks to FormatFloat function which work very fine. But, when strings need to be "masked", FormatFloat can't be used anymore
This is why I need to use FormatMaskText then, and this function work different than FormatFloat
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#15
Posted 21 November 2007 - 02:05 PM
I have to come back to this post since I have problem with Footer's Format Mask with the new version of NextGrid. In the version 4.0.1, the column's Format Mask also works for footer (we don't need to provide Footer's Format Mask). But from the version 4.1.5, this behavior has change. Now we don't have masked value in footer by any way.
I use Delphi 7.
#16
Posted 21 November 2007 - 03:24 PM
I recommend using next code before you set Format.Caption property:
var
N: Double;
begin
N := 5122198.13;
NextGrid1.Columns[0].Footer.Caption := FormatFloat(TNxNumberColumn(NextGrid1.Columns[0]).FormatMask, N);
end;
I hope that this code will help you. Just change N variable to desired variable/value.
This code will set same FormatMask as for column.
Best regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#17
Posted 22 November 2007 - 05:19 AM
Kind regards
#18
Posted 22 November 2007 - 08:35 AM
But, I didn't change this behaviour in last release. I am still using FormatMaskText procedure as before (as I mentioned on top of the topic).
Please note that Footer.Caption may contain letters and numbers, but FormatMask is used for NumberColumn only. This is why I needed to use different functions for Footer and for NumberColumn.
Maybe only solution is to have FormulaFormatMask property.
Best regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#19
Posted 22 November 2007 - 10:51 AM
You may not change it directly but other update can change it indirectly. You still remember that the multi-line caption header feature break Unicode typing in Delphi 7, don't you?
Let me say again my problem.
I have number column. The formula kind is fkSum. I put #,##0 as the column format mask. I leave footer format mask blank. The column alignment and footer alignment is taRightJustify.
When I compile it with NextGrid v4.0.1, the footer value is masked perfectly.
When I compile it with NextGrid v4.1.5 or 4.2.1, the footer value is not masked any more.
So the conclusion is something has changed.
I don't see any benefit of using mask for character data. People tend to use format mask for number data only. But if you want to keep it like this, you can allow user to choose FormatMaskText or FormatFloat to be applied. This property can be added for both column and footer. By this way, you don't need to care the data are number or not neither a formula is used or not.
Kind regards
#20
Posted 22 November 2007 - 11:18 AM
When I read through this topic again, I found that you recommended to use MaskKind in the post # 5 but in the post # 9 you said it is not a good idea. I don't know why you said it is not good. From the end user's point, it is better than using Formula Mask (string). If you add Formula Mask, there will be two format masks for the footer and user can be confuse.
Kind regards,
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users