Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl empty cells pasted from Excel
Re: GridCtrl empty cells pasted from Excel [message #17694 is a reply to message #17362] |
Tue, 26 August 2008 11:16   |
 |
koldo
Messages: 3443 Registered: August 2008
|
Senior Veteran |
|
|
Hello unodgs
Sorry. I have found the problem in my program but I do not know how to fix it.
The problem comes from a field with "SetDisplay" that gets the exception when pasting from Notepad and corrupts the Date field beside it as described in the posts.
For example this works right:
myGridCtrl.AddColumn(ISMARRIED, t_("Is married?")).Edit(isMarried).Default(-1);
and this wrong:
myGridCtrl.AddColumn(ISMARRIED, t_("Is married?")).SetDisplay(Single<DispPM>()).Edit(isMarried).Default(-1);
isMarried is declared this way:
DropGrid isMarried;
And initialized this way:
isMarried.Add(1, t_("Yes")).Add(-1, t_("No"));
So I want to store an integer from a DropGrid with strings.
Going to DisPM, as I want to see "Yes" or "No" in the cells, this is the original version that works properly with rows copied directly from GridCtrl but gets an exception if copied from Notepad:
struct DispPM : GridDisplay
{
virtual void Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style, Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe)
{
String text;
if(!val.IsNull())
text = int(val) > 0 ? "Yes" : "No";
else
text = "";
GridDisplay::Paint(w, x, y, cx, cy, Value(text), style, fg, bg, fnt, found, fs, fe);
}
};
This other version lets paste from Notepad but does not show "Yes" or "No" but empty cells
struct DispPM : GridDisplay
{
virtual void Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style, Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe)
{
w.DrawRect(x, y, cx, cy, bg);
if(!val.IsNull())
w.DrawText(x, y, int(val) > 0 ? "Yes" : "No", fnt, fg);
GridDisplay::Paint(w, x, y, cx, cy, Value(""), style, fg, bg, fnt, found, fs, fe);
}
};
Do you have any idea?
Best regards
IƱaki
|
|
|
 |
|
GridCtrl empty cells pasted from Excel
By: koldo on Sat, 09 August 2008 01:11
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Mon, 25 August 2008 12:31
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: unodgs on Mon, 25 August 2008 14:37
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: unodgs on Mon, 25 August 2008 14:51
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: unodgs on Mon, 25 August 2008 15:07
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Mon, 25 August 2008 22:02
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: unodgs on Mon, 25 August 2008 23:03
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Tue, 26 August 2008 11:16
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: unodgs on Tue, 26 August 2008 12:08
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Tue, 26 August 2008 12:07
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Tue, 26 August 2008 16:11
|
 |
|
Re: GridCtrl empty cells pasted from Excel
By: koldo on Tue, 26 August 2008 16:24
|
Goto Forum:
Current Time: Sun Aug 24 15:22:08 CEST 2025
Total time taken to generate the page: 0.00628 seconds
|