Home » U++ Library support » LineEdit, EditFields, DocEdit » EditString: how to convert data with "~" operator to char*?
Re: Editstring control [message #10198 is a reply to message #10173] |
Sun, 24 June 2007 23:16   |
malaugh
Messages: 7 Registered: June 2007
|
Promising Member |
|
|
Fantastic, thanks for your help. I tried your link and it works great. I was able to read out a hex value from the EditFiled after changing the code to do the hex conversion.
There is another issue though. How do I write to the EditField? I thought I could change the FormatIntBase function to base 16, but I ran into problems. Here is part of my code that I was using to debug the problem.
void HexEdit::OnPopulate()
{
int x = 1234;
char s[20];
Value y = 1234;
Value z;
sprintf(s,"%d",x);
z = FormatIntBase(y, 2, 0, 0, 0);
editOutput = s;
// editOutput = x;
// editOutput = y;
// editOutput = z;
}
editOutput is an EditField control. Here is what happens:
editOutput = s; works, it displays 1234
editOutput = x; crashes the program.
editOutput = y; crashes the program.
editOutput = z; works, it displays the binary conversion of 1234
I am not sure why y should fail and z should pass.
Also if I change the code by putting
editOutput.SetConvert(Single<ConvertBin>());
in the initialization (which should call FormatIntBase on a write to the control, and remove FormatIntBase from the populate function, the program crashes.
What am I doing wrong? Any suggestions?
|
|
|
Goto Forum:
Current Time: Sat Apr 26 08:41:17 CEST 2025
Total time taken to generate the page: 0.02123 seconds
|