|
I have two edit boxes. By default edit boxes allow copy, cut, paste and delete features. But now i should not allow copy, cut, paste and delete features in edit boxes.
knarasimharao
|
|
|
|
|
Override the WM_CUT, WM_COPY and WM_PASTE handlers.
You can leave the handlers empty.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I have a static control(derived from CStatic) and rich edit controls and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help?
knarasimharao
|
|
|
|
|
Just an out line of procedure. customizee as you like
HWND hRichEdit = NULL;
CHARFORMAT* cf = NULL;
hRichEdit = (HWND)GetDlgItem (IDC_RICHEDIT);
CHARRANGE cr;
cr.cpMin = 0; // set strating char position
cr.cpMax = -1;// end char pos
SendMessage(hRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
cf = new CHARFORMAT;
cf->cbSize = sizeof(CHARFORMAT);
cf->dwMask = CFM_COLOR |CFM_BOLD|CFM_FACE|CFM_SIZE|CFM_ITALIC;
cf->dwEffects = CFE_BOLD;
cf->crTextColor = RGB(255,0,0);
cf->yHeight = 160;
strcpy ( cf->szFaceName, "Ariel");
SendMessage( (HWND) hRichEdit, SCF_SELECTION, (WPARAM) SCF_ALL, (LPARAM) cf);
All the best
AnilFirst@gmail.com
|
|
|
|
|
anilFirst wrote: CHARFORMAT* cf = NULL;
Won't this work...
CHARFORMAT cf;
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
>>Won't this work...
>>CHARFORMAT cf;
It will....Carry on
AnilFirst@gmail.com
|
|
|
|
|
I have a static control(derived from CStatic) and rich edit controls and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help?
knarasimharao
|
|
|
|
|
Hi
I have created a CButton in the following way.
CButton btnTemp;
UINT uiBtnStyle = BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP;
btnTemp->Create(szButtonName, uiBtnStyle, rectGroups, this, IDC_TEMP);
When I have focus on the button ,enter key press on the button does not trigger the Event for the button.
Someone tell me where I must have gone wrong.
Thanks,
Gayathri.
|
|
|
|
|
hi..
are u sure u have made a object btnTemp and used "->" operator and it ran with out any error.i have amazed?May u have mistaken while writing here.
Check out the declaration and definition for the massege map fuction of that button control.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
Then do Space trigger the event
or
might be the button is not focued
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi ,
Pressing Space bar does trigger the event.
The problem is Enter Key does not and the button does have focus.
Thanks,
Gayathri
|
|
|
|
|
GayathriNaveen wrote: The problem is Enter Key does not and the button does have focus.
Yeah it's happening here too. It's international .
But second time the button has focus it's working. Press tab and remove focus and then press Shift+Tab to shift back the focus. Now enter will work.
(Not the solution;P)
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
HI..
I am devloping an application for Window CE.NET device running on x86 board.I want to debug my program in my workstation(a window xp based pc)by conecting the target device through eVC++'s platform manager.HOW COULD I CONNECT THE TARGET DEVICE USING TCP/IP FOR WINDOW CE?
I have selected the startup server as manual server,then the platfom manager dialogg box gave some file names to be present in my target device and told to run a command line to run in my target device.I ahve searched for those files,ofcourse they are present there in my target device but that command line is not working in my target device.PLZ help me...
thanx in advance.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
I derived a class from CAsyncSocket;
if i want to send data,
shall i use AsyncSelect(FD_WRITE) and send data in virtual function OnSend(int nErrorCode);
Or use Send(const void* lpBuf,int nBufLen,int nFlags = 0) directly
|
|
|
|
|
if you want ASync send then AsyncSelect(FD_WRITE) (only once)
followed by many Send to send as many data, if you dont want ASync Data Sending then AsyncSelect(FD_WRITE) is not required.
MSDN has very good doc on this, you should read that first.
-Prakash
|
|
|
|
|
How can I make a message when the number of charactors in the editbox reaches 3?
Thanks!
|
|
|
|
|
Handle the EN_CHANGE message sent by the editbox to it's parent window. Send a WM_GETTEXTLENGTH message to the editbox to check how many characters are in it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: WM_GETTEXTLENGTH
PJ Arends wrote: A question and An answer
He he funny.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Owner drawn wrote: An answer TO an Answer
Thats funny too.
-Prakash
|
|
|
|
|
|
I think you want to display a message box right?
So you can use EN_CHANGE handler for this purpose. And use GetWindowText(...)
to count the number of chars in the edit.
But this won't prevent the user from furthur inserting any chars in the edit.
But you can prevent this by subclassing the edit and handling WM_CHAR message. If the count in less than 3 then fine call the base class handler or else don't call it instead display a message box. This will prevent the user from inserting further chars.
Hope this is what you want.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I'll assume you are using MFC, so if so you just need to write a function on the edit boxes EN_CHANGE event. The code insode the function would be something like this
{
// m_EditText is the CString that stores the edit text(whatever you called it)
if (strlen(m_EditText) > 3)
{
// Use other message box function and add correct handle if you know it
MessageBox(NULL, "My Text is to long", "Message Caption", 0);
}
}
I believe there are functions to get the size directly from the edit box in MFC but I don't like MFC so I tend to avoid it where possible.
-- modified at 23:05 Wednesday 4th January, 2006
|
|
|
|
|
Owner drawn wrote: But this won't prevent the user from furthur inserting any chars in the edit.
But you can prevent this by subclassing the edit and handling WM_CHAR message. If the count in less than 3 then fine call the base class handler or else don't call it instead display a message box. This will prevent the user from inserting further chars.
EM_LIMITTEXT
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: EM_LIMITTEXT
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
What I wanted was moving the focus of my keyboard to another place as soon as the number of charactors in the editbox reaches 3.
And I think what you told me can solve my problem.
Thanks a lot!
|
|
|
|