GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Sep-2004, 05:10
mithila mithila is offline
New Member
 
Join Date: Sep 2004
Posts: 8
mithila is on a distinguished road
Question

edit box


hi,
i've declared variables as CEdit,CString for both edit boxes.
In 1 edit box,i've to give characters.
In the second for each click of combo,i've to receive character by character.
How is it possible?

Mithila.
  #2  
Old 27-Sep-2004, 09:57
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 961
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by mithila
hi,
i've declared variables as CEdit,CString for both edit boxes.
In 1 edit box,i've to give characters.
In the second for each click of combo,i've to receive character by character.
How is it possible?

Mithila.

Do you mean you have 2 edit boxes and a combo box? And you want to take the characters of a string in one of the edit boxes when you click on the combo box and then display them in the second edit box!!?? Why would you program somethink like that

Anyway.... I will just consider you meant "button" , not "combo".
So, let's call the 2 associated CString variables m_inputEditBox and m_OutputEditBox. Also, please add a member variable called pos, that we will use in order to know where in the string we are.
Add this line in your OnInitDialog:

CPP / C++ / C Code:
	pos = 0;

Then, in your OnClick method:

CPP / C++ / C Code:
void CSampleDlg::OnButton1() 
{
	UpdateData(TRUE);
	if ( pos < m_inputEditBox.GetLength() )
	{
		m_OutputEditBox.Insert(m_OutputEditBox.GetLength(), m_inputEditBox.GetAt(pos++));
		UpdateData(FALSE);
	}
}

Voila!
If this isn't what you wanted to do (and chances are it's not), pls. let me know and also pls. provide some (clear) specifications.

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #3  
Old 29-Sep-2004, 07:21
mithila mithila is offline
New Member
 
Join Date: Sep 2004
Posts: 8
mithila is on a distinguished road
Question

I've to read from port


Quote:
Originally Posted by LuciWiz
Do you mean you have 2 edit boxes and a combo box? And you want to take the characters of a string in one of the edit boxes when you click on the combo box and then display them in the second edit box!!?? Why would you program somethink like that

Anyway.... I will just consider you meant "button" , not "combo".
So, let's call the 2 associated CString variables m_inputEditBox and m_OutputEditBox. Also, please add a member variable called pos, that we will use in order to know where in the string we are.
Add this line in your OnInitDialog:

CPP / C++ / C Code:
	pos = 0;

Then, in your OnClick method:

CPP / C++ / C Code:
void CSampleDlg::OnButton1() 
{
	UpdateData(TRUE);
	if ( pos < m_inputEditBox.GetLength() )
	{
		m_OutputEditBox.Insert(m_OutputEditBox.GetLength(), m_inputEditBox.GetAt(pos++));
		UpdateData(FALSE);
	}
}

Voila!
If this isn't what you wanted to do (and chances are it's not), pls. let me know and also pls. provide some (clear) specifications.

Kind regards,
Luci

Hi,
Thks 4 ur help.
I've to write characters to the port.
While reading from the port only i've to do those operation(ie: for each click of a button, read character by character from the port).
How is it possible.
What codings i've to do?

This is correct?

CPP / C++ / C Code:
if ( pos < m_cssendchar.GetLength() )
{
	UpdateData();
	m_csreceivechar.Insert(m_cssendchar.GetLength(), m_csreceivechar.GetAt(pos++));
	port.ReadByte(m_csreceivechar);
	UpdateData(false);
}

pls help me.
Last edited by LuciWiz : 30-Sep-2004 at 02:30. Reason: PLEASE, PRETTY PLS - USE [c] [/c] tags for your code...
  #4  
Old 30-Sep-2004, 02:45
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 961
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by mithila
I've to write characters to the port.
Quote:
Originally Posted by mithila
While reading from the port

Is this not confusing for you

There would also be the matter of:
Quote:
Originally Posted by mithila
In 1 edit box,i've to give characters.
In the second for each click of combo,i've to receive character by character.

I am really lost...

CPP / C++ / C Code:
m_csreceivechar.Insert(m_cssendchar.GetLength(), m_csreceivechar.GetAt(pos++));

What is wrong here? Well, you are working with m_csreceivechar *ONLY*. You are putting characters from m_csreceivechar into m_csreceivechar!!!

Maybe this is what you are trying to do?

CPP / C++ / C Code:
m_cssendchar.Insert(m_cssendchar.GetLength(), m_csreceivechar.GetAt(pos++));

Why are you asking me if your code is correct? Does it do what you want it to do?

Please don't take this to hard, I'm not trying to scare you or anything... I am really trying to help, but you must understand your logic is NOT clear for me at all.
Please try concentrating on this problem, and I'm sure you will be able to get it right! I will answer any questions you might still have - but please concentrate, OK?

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
 
 

Recent GIDBlogToyota - 2008 November Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help to solve me a problem with multiline texrbox and checkbox mithila MS Visual C++ / MFC Forum 0 08-Sep-2004 23:08
CRichEditView/CEditView Color edit JeroenGN MS Visual C++ / MFC Forum 1 27-Jul-2004 17:18
suggestion modifying posts machinated GIDForums™ 9 15-May-2004 22:12
AdManagement Solutions BobbyDouglas MySQL / PHP Forum 8 02-Apr-2004 09:25
Little Help please pcxgamer MySQL / PHP Forum 9 21-Sep-2002 07:45

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:45.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.