1. Adding Text to Richedit Control

I'm considering my very first Windows(tm) program and am going to need a
little help.

To start out simple, I'm thinking of just using a Richedit control to
display what would normally be displayed using puts()...

How would I add text to simulate the DOS screen display? I've got the
following to start:

--  code generated by Win32Lib IDE v0.14.2

include Win32Lib.ew
without warning

----------------------------------------------------------------------------
----
--  Window MainWin
constant MainWin = createEx( Window, "MatrixLife", 0, Default, Default, 400,
300, 0, 0 )
constant RichEdit2 = createEx( RichEdit, "", MainWin, 4, 28, 384, 244,
or_all({ES_NOHIDESEL}), 0 )
---------------------------------------------------------

WinMain( MainWin,Normal )

new topic     » topic index » view message » categorize

2. Re: Adding Text to Richedit Control

You can use this routine:

--/*
-- edittext_add_text [Created on 1. June 2002, 07:54]
-- The 'edittext_add_text' procedure adds text
-- to end of standard windows edit control. Previous text
-- doesnt get deleted.
--
-- PARAMETERS
-- 'id'
--    Edit window.
-- 'text'
--    Text to add to end.
--*/
global procedure edittext_add_text (integer id, sequence text)
    atom mset, pstr
    mset = new_memset()
    pstr = acquire_mem( mset, text )
 Void=sendMessage(id,EM_SETSEL,-1,-1)
 Void=sendMessage(id,EM_REPLACESEL,true,pstr)
    release_mem(mset)
end procedure

----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, November 12, 2002 2:28 AM
Subject: Adding Text to Richedit Control


>
> I'm considering my very first Windows(tm) program and am going to need a
> little help.
>
> To start out simple, I'm thinking of just using a Richedit control to
> display what would normally be displayed using puts()...
>
> How would I add text to simulate the DOS screen display? I've got the
> following to start:
>
> --  code generated by Win32Lib IDE v0.14.2
>
> include Win32Lib.ew
> without warning
>
> --------------------------------------------------------------------------
--
> ----
> --  Window MainWin
> constant MainWin = createEx( Window, "MatrixLife", 0, Default, Default,
400,
> 300, 0, 0 )
> constant RichEdit2 = createEx( RichEdit, "", MainWin, 4, 28, 384, 244,
> or_all({ES_NOHIDESEL}), 0 )
> ---------------------------------------------------------
>
> WinMain( MainWin,Normal )
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Adding Text to Richedit Control

------------vJbz2678ZVYajOqzwgMBh0

Attached is some code that emulates a DOS screen.

For those who can't get attachements and want the code, send me a message and I
can email it to you
direct.

12/11/2002 12:28:12 PM, "C. K. Lester" <cklester at yahoo.com> wrote:

>
>I'm considering my very first Windows(tm) program and am going to need a
>little help.
>
>To start out simple, I'm thinking of just using a Richedit control to
>display what would normally be displayed using puts()...
>
>How would I add text to simulate the DOS screen display? I've got the
>following to start:
>
>--  code generated by Win32Lib IDE v0.14.2
>
>include Win32Lib.ew
>without warning
>
>----------------------------------------------------------------------------
>----
>--  Window MainWin
>constant MainWin = createEx( Window, "MatrixLife", 0, Default, Default, 400,
>300, 0, 0 )
>constant RichEdit2 = createEx( RichEdit, "", MainWin, 4, 28, 384, 244,
>or_all({ES_NOHIDESEL}), 0 )
>---------------------------------------------------------
>
>WinMain( MainWin,Normal )
>
>
>
>
---------
Cheers,
Derek Parnell 
ICQ# 7647806


------------vJbz2678ZVYajOqzwgMBh0
Content-Disposition: attachment;
	filename="db.exw"
Content-Type: application/octet-stream

new topic     » goto parent     » topic index » view message » categorize

4. Re: Adding Text to Richedit Control

Errr, no. Its a little bit more complicated than that, and I don't have much
time right now to work out the details.

----------------
cheers,
Derek Parnell
----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Adding Text to Richedit Control


>
>
> Derek Parnell wrote:
> > Attached is some code that emulates a DOS screen.
>
> Derek, can you write a procedure that overrides the built-in puts()?
> That way, I could drop my DOS code right into your DOS emulator.
>
> And position() too.
>
> Thanks!
> ck
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Adding Text to Richedit Control

> Errr, no. Its a little bit more complicated than that, and I don't have
much
> time right now to work out the details.

It is not! You just create a puts() procedure that accepts two parameters,
one being '1' and the other being a sequence of text you want printed. How
hard is that?! (No, don't use that same argument against me.) :)

And position is just positioning the text cursor!!!

I understand about the "no time" though, so don't worry about it.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Adding Text to Richedit Control

Okay, then you do it!

For example, where does the "text" go to? A window? A Pixmap? An Editbox? A
what?

How do we handle repaint requests?

What do we do about colors?

What do we do about control chars such as TAB and Backspace?




----------------
cheers,
Derek Parnell
----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, November 21, 2002 7:01 AM
Subject: Re: Adding Text to Richedit Control


>
> > Errr, no. Its a little bit more complicated than that, and I don't have
> much
> > time right now to work out the details.
>
> It is not! You just create a puts() procedure that accepts two parameters,
> one being '1' and the other being a sequence of text you want printed. How
> hard is that?! (No, don't use that same argument against me.) :)
>
> And position is just positioning the text cursor!!!
>
> I understand about the "no time" though, so don't worry about it.
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: Adding Text to Richedit Control

> Okay, then you do it!

I knew you were gonna say that.

> For example, where does the "text" go to? A window? A Pixmap? An Editbox?
A
> what?

Duh! It goes right where you're putting it in your demo. That big black box
thingie.

> How do we handle repaint requests?

How don't you?!

> What do we do about colors?

Make 'em pretty.

> What do we do about control chars such as TAB and Backspace?

Add or subtract spaces.

Thus endeth the lesson.

-ck

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu