News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Inserting text in Richedit

Started by HSE, May 12, 2017, 04:04:24 AM

Previous topic - Next topic

HSE

Hi!

Somebody have been sucessful inserting a text in cursor position of the text a RichEdit already have? How?

Thanks. HSE
Equations in Assembly: SmplMath

TWell

use EM_REPLACESEL after selecting insert position.

newrobert

a hexedit demo contain list and edit using;

HSE

Thanks Tim!
I have tried that in a subclassed Richedit and not work well.
Now I make a simple test and work perfect.
Ergo, there is something wrong in the subclass  :(
Equations in Assembly: SmplMath

HSE

Thanks newrobert!

Not so easy because there is some problem with window size, but I will see. :t
Equations in Assembly: SmplMath

HSE

I found that in the subclass EM_GETSEL and EM_SETSEL are not retriving cursor position before and after to paint. Work perfect with EM_EXGETSEL and EM_EXSETSEL.

Thanks.
Equations in Assembly: SmplMath

newrobert

maybe you can use setfocus before EM_SEL

jj2007

GuiParas equ "Insert text in RichEdit control", w180, h80, s0
include \masm32\MasmBasic\Res\MbGui.asm
GuiControl MyEdit, "RichEdit", bgcol RgbCol(255, 255, 160), text cfm$("Press space to insert text here:\n[ _____ _____ ]")
Event Key
  If_ VKey2==VK_SPACE Then AddWin$ hMyEdit="Hello World", 35, 46
GuiEnd
;)

HSE

HJWasm v2.14, Jun 29 2016, Masm-compatible assembler.
··· High macro levels, simultaneus ObjAsm and SmplMath adapted version ···
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

*** MasmBasic version 24.04.2017 ***
Myarg=-1, -1, 180, 80
## Simple GUI template ##
\jj1.asm(5) : Warning A4149: Too many arguments in macro call: AddWin$: ,35,46
If_(17)[MasmBasic.inc]: Macro called from
  \jj1.asm(5): Main line code
## creating 1 controls ##
\masm32\MasmBasic\Res\MbGui.asm(5) : Error A2102: Symbol not defined : VKey2
\jj1.asm: 6 lines, 2 passes, 424 ms, 1 warnings, 1 errors, 6 maxmacrolevel


Fortunately the issue was solved this morning! You can see at work in the derivator
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on May 13, 2017, 10:21:26 AMHJWasm v2.14, Jun 29 2016, Masm-compatible assembler.
*** MasmBasic version 24.04.2017 ***

Your tools are not really the latest ones ;)
But thanks for trying :t

HSE

Quote from: jj2007 on May 13, 2017, 05:08:43 PM
Your tools are not really the latest ones ;)
Just to show that is impossible to be updated with your advances  :biggrin:

AddWin$ obviously is improved this days, but I don't know what is the Vkey2 thing (I'm sure it will very interesting... other day).

Thanks.
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on May 13, 2017, 10:48:41 PMwhat is the Vkey2

Event Key
  Switch_ VKey2
  Case_ VK_LEFT
  ...


The "normal" VKey variable is VK_LEFT if the key was pressed while the main hWnd had the focus, but it's -VK_LEFT if the key was pressed inside the RichEdit control.

Since that was sometimes clumsy to test (.if VKey==VK_LEFT || VKey==-VK_LEFT), I added VKey2 which tests 2 conditions simultaneously, i.e. VKey2 is always positive, independently of who had the focus.