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 » 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 Go to previous messageGo to previous message
malaugh is currently offline  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?



 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: EditInt callback?
Next Topic: DocEdit bug
Goto Forum:
  


Current Time: Thu Apr 25 12:08:43 CEST 2024

Total time taken to generate the page: 0.02573 seconds