Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl empty cells pasted from Excel
Re: GridCtrl empty cells pasted from Excel [message #17695 is a reply to message #17362] |
Tue, 26 August 2008 12:07   |
 |
koldo
Messages: 3443 Registered: August 2008
|
Senior Veteran |
|
|
Well, I have found the problem.
This function gets the exception in "int(val)" because when pasted from outside GridCtrl, a "1" instead of being an int is a string!!
The function:
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);
}
};
So changing
text = int(val) > 0 ? "Yes" : "No";
with
if (val.Is<String>()) {
String s = val;
if (s == "1")
text = "Yes";
else
text = "No";
} else
texto = int(val) > 0 ? "Yes" : "No";
it works.
The simplest way to get the exception is:
String s = "1";
Value val = s;
int i = int(v);
Question: Is there a way to convert a Value to int in a safe way?
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:37:13 CEST 2025
Total time taken to generate the page: 0.05491 seconds
|