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 » Uppercase in EditField and cursor position
Uppercase in EditField and cursor position [message #52265] Thu, 22 August 2019 12:59 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I wrote a method to set uppercase the content of an EditField:

void UppercaseField(EditField * f){

   String content = f->GetData();
   f->SetData(ToUpper((String)f->GetData()));
   f->Move(f->GetLength());
}


This code is "activated" setting a callback on the WhenAction method of the control.

I have a couple problem with that.

First of all, maybe already exists some property or function to automatically set uppercase the content of a field, so I can avoid at all that method.

The second problem, is that the method above works well when the user enter the text, but it does not work properly when the user *correct* the text. The problem is in the last line: the cursor is moved to the end, and that is ok when entering the text, but if the user has to correct the text. Let's say the user to change the 3rd letter of the text: he positions the cursor, deletes the third char, but when doing that the callback calls the method, and when the user enters the new char, the cursor has been already moved at the end of the field. I need a way to know the position of the cursor, so I can save it and move the cursor to that position instead of moving it at the end of the line.

How can I fix this?

Regards,
gio
 
Read Message
Read Message
Read Message
Previous Topic: Empty DocEdit pre-selecting keypresses (nightly)
Next Topic: Input mask on an EditInt
Goto Forum:
  


Current Time: Fri Mar 29 14:44:08 CET 2024

Total time taken to generate the page: 0.01151 seconds