Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
koldo is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: adding row from another window and updating GUI
Next Topic: Unicode character paste in GridCtrl
Goto Forum:
  


Current Time: Sun Aug 24 10:11:16 CEST 2025

Total time taken to generate the page: 0.05449 seconds