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 » U++ Library : Other (not classified elsewhere) » EditControl with AllCaps, OnlyNums, and ErrorMsg dialog
EditControl with AllCaps, OnlyNums, and ErrorMsg dialog [message #37518] Sun, 14 October 2012 04:45 Go to next message
luisrod0512 is currently offline  luisrod0512
Messages: 6
Registered: February 2012
Promising Member
Congratulations to all of you for this great framework...

Here from Venezuela, I propuse some lines of code to make it better...


In EditCtrl.h
-------------
class EditField : public Ctrl, private TextArrayOps {
protected:
bool initcaps:1;
bool allscaps:1;
bool onlynums:1;

public:
EditField& InitCaps(bool b = true) { initcaps = b; return *this; }
EditField& AllsCaps(bool b = true) { allscaps = b; return *this; }
EditField& OnlyNums(bool b = true) { onlynums = b; return *this; }
bool IsInitCaps() const { return initcaps; }
bool IsAllsCaps() const { return allscaps; }
bool IsOnlyNums() const { return onlynums; }


In EditField.cpp
----------------
void EditField::Insert(int chr)
{
if(IsReadOnly()) return;
if(onlynums && ( chr < 48 || chr > 57)) return;
if((initcaps && cursor == 0 && text.GetCount() == 0) || allscaps)
chr = ToUpper(chr);
cursor += Insert(cursor, WString(chr, 1));
Finish();
}

In Prompt.cpp
-------------
void ErrorNOK(const char *qtf) {
BeepExclamation();
Prompt(Ctrl::GetAppName(), CtrlImg::error(), qtf, t_("OK"));
}

In RichText.h
-------------
void ErrorNOK(const char *qtf);


Thanks you for creating one of the best tool to develop software in C++ I've ever known.

Luis Rodriguez
Software Developer..
Re: EditControl with AllCaps, OnlyNums, and ErrorMsg dialog [message #37520 is a reply to message #37518] Sun, 14 October 2012 09:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
luisrod0512 wrote on Sat, 13 October 2012 22:45

:
EditField& InitCaps(bool b = true) { initcaps = b; return *this; }
EditField& AllsCaps(bool b = true) { allscaps = b; return *this; }
EditField& OnlyNums(bool b = true) { onlynums = b; return *this; }



EditField::SetFilter is the generic way, no need to provide special modes for this.
Re: EditControl with AllCaps, OnlyNums, and ErrorMsg dialog [message #37531 is a reply to message #37520] Mon, 15 October 2012 05:12 Go to previous message
luisrod0512 is currently offline  luisrod0512
Messages: 6
Registered: February 2012
Promising Member
mirek wrote on Sun, 14 October 2012 09:37

luisrod0512 wrote on Sat, 13 October 2012 22:45

:
EditField& InitCaps(bool b = true) { initcaps = b; return *this; }
EditField& AllsCaps(bool b = true) { allscaps = b; return *this; }
EditField& OnlyNums(bool b = true) { onlynums = b; return *this; }



EditField::SetFilter is the generic way, no need to provide special modes for this.




I created two functions
int OnlyNums(int);
int AllsCaps(int);

and then I used them as in this example "tsp_Descri.SetFilter(AllsCaps);"

and everything worked perfect..

Thank you Mirek....
Previous Topic: flexibelize RectTracker, only works TopLeft -> BottomRight
Next Topic: umk got changed....
Goto Forum:
  


Current Time: Fri Mar 29 14:50:51 CET 2024

Total time taken to generate the page: 0.01549 seconds