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++ Widgets - General questions or Mixed problems » Extending EditString to filter keys
Extending EditString to filter keys [message #31168] Fri, 11 February 2011 11:54 Go to previous message
Jeremi is currently offline  Jeremi
Messages: 3
Registered: February 2011
Location: spain
Junior Member
Hi all
I am a beginner in Upp. Very cool lib!!
I am trying to make an edit control to acept only letters (a-z and A-Z) so I extended a new class from EditString and i am trying to implement it, like this:

#ifndef _MYEDIT_h
#define _MYEDIT_h
#include <CtrlLib/CtrlLib.h>
using namespace UPP;
class MyEditString : public EditString
{
public:
	typedef MyEditString CLASSNAME;
        MyEditString();
	~MyEditString();	
	virtual bool  Key(dword key, int repcnt);

private:

};
#endif

--------------------------

#include "MyEditString.h"

MyEditString::MyEditString()
{
}

MyEditString::~MyEditString()
{
}

bool MyEditString::Key(dword key, int repcnt)
{
	if(key == K_F)
	{
                Exclamation("f was pressed")
		return true;
	}
	return EditString::Key(key, repcnt);
}


Then I added a EditString to a dialog and change its type from EditString to MyEditString (now just to detect the F and prevent it from appearing in edit box!)

It works. It detects f and it prevents it from appearing in the edit box but if I remove the Exclamation the f appears in the edit box.

I thought that when the return true we are saying that the event is already handled, but returning true the f appears and I want to prevent it from appear.

Any help?

Thank to all of you


Jeremi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Focus without selecion
Next Topic: Modern looking U++ controls
Goto Forum:
  


Current Time: Mon Apr 29 09:32:18 CEST 2024

Total time taken to generate the page: 0.02410 seconds