The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: elmo on October 20, 2010, 06:38:07 AM

Title: how to update a line in EditBox
Post by: elmo on October 20, 2010, 06:38:07 AM
Example:
I create 1 Button, 1 EditBox.

I type something in the EditBox   (4 lines below):

create combo1
create button1
create label1
create toolbar1

Then, I click that Button.
I hope I can change the line who contain "button1" to become "edit button1"
So, in the editbox, it will become:

create combo1
edit button1
create label1
create toolbar1

could you help me to solve this problem?
Thank you
Fritz Gamaliel
Title: Re: how to update a line in EditBox
Post by: jj2007 on October 20, 2010, 06:39:52 AM
EM_REPLACESEL (http://msdn.microsoft.com/en-us/library/bb761633(VS.85).aspx)
Title: Re: how to update a line in EditBox
Post by: elmo on October 21, 2010, 06:44:24 AM
hi jj2007
that's an easy case.
What if the condition like this:

I type in the TextBox

create combo1
mov combo1,eax
create button1
mov button1,eax
create label1
mov label1,eax
create toolbar1
mov toolbar1,eax

I want to change the line that have button1 to become "edit button1".
If I use EM_REPLACESEL, it will replace 2 lines, so it will be:


create combo1
mov combo1,eax
edit button1       ;change in here
edit button1       ;change in here
create label1
mov label1,eax
create toolbar1
mov toolbar1,eax

I don't want it happen. I want only change that TextBox to become like this:

create combo1
mov combo1,eax
edit button1       ;change only in here
mov button1,eax
create label1
mov label1,eax
create toolbar1
mov toolbar1,eax

could you help me to solve this problem and show me the code example?
Thank you
Fritz Gamaliel
Title: Re: how to update a line in EditBox
Post by: jj2007 on October 21, 2010, 07:01:15 AM
As the name says, EM_REPLACESEL replaces the selection. Find out how to set the selection.