|
From: Ramana K. <ra...@my...> - 2002-07-02 12:21:42
|
Hi, I would like to use a control in my win32 app written in C++ using ONLY win32 API (i.e. not MFC) that lets me write text in different fonts or colours to the screen, but is read only, i.e. is for output only, not input. Before implementing the functionality of this control, i had made it a simple edit control, because the simple edit control for my input window is working fine, but it seems this will not work for output as edit controls set their text all at once (i need to be able to send text to the control as i need to, and have it appended) and edit controls cannot take text of more than one font. the next thing i thought of is to use the TextOut function, but i fear this will not be very easy, and may not be a complete solution, because i'll need the text to be scrollable after there is too much of it, and it needs to word wrap to the size the user makes the window. what i have been looking at tonight is the richedit control, which may do the job, but i cannot find any information about how to use it using win32 api calls in c++. is richedit the way to go? if so, how do i use it? can i create one using CreateWindowEx and send it messages using SendMessage or specialised functions? this is what i would like: HWND hOutput = CreateWindowEx(special edit control thingy details); HFONT hFont = CreateFont(... whatever) SendTextorSimilar(hOutput,hFont,char* text,etc...); GetTextorSimilar(hOutput,&text,etc...); something along those lines. is there a control for me? is there documentation? by control, obviously i mean a window which is going to be a child window of my app. also, all the functionality of the control has to be already written up so i can just call the functions, so does this mean it has to be a common control (i don't know how many of these there are)? my biggest fear right now is that there is no common rich text control (like there is no splitter control) and i'll have to write something myself like i wrote my splitter bar window, but it won't be so easy. so, anyone know how to use richedit in win32 api? thanks ramana p.s. i will probably not reply to (nor receive) any replies to this message for the next 14 days or so, because i'm going away so, yeah, (if anyone is interested lol) |
|
From: Carlos d. M. <cg...@wo...> - 2002-07-09 18:59:19
|
I am learning windows, with a book after having read some tutorials, so I= cannot say much, but I don't remember any answer, so here are my two cents: In the Win32API reference (13MB) you can download at http://www.cs.virginia.edu/~lcc-win32/, there are some pages about rich e= dits, the introductory one (which does not explain anything) says this: A rich edit control is a window in which the user can enter and edit text= . The text can be assigned character and paragraph formatting, and can include embedded OLE objects. Rich edit controls provide a programming interface = for formatting text. However, an application must implement any user interfac= e components necessary to make formatting operations available to the user. I eyed the pages about rich edit controls very quickly, if I understood w= ell, you can use rich edit controls without OLE, although they support OLE. In your message it seems like you don't know the DrawText function, which= makes some wrapping of the text to the window (see below), and its prototype is= , pasted from the win32api reference: int DrawText( HDC hDC, // handle to device context LPCTSTR lpString, // pointer to string to draw int nCount, // string length, in characters LPRECT lpRect, // pointer to structure with formatting dimensions UINT uFormat // text-drawing flags ); lpRect is, of course, the rectangle defining the region of the window whe= re you want display the text. This would be the better alternative to rich edits than textout, if they'= re not available without OLE, since it makes a part of the work. Ramana Kumar escribi=F3: > Hi, > I would like to use a control in my win32 app written in C++ using ONLY > win32 API (i.e. not MFC) that lets me write text in different fonts or > colours to the screen, but is read only, i.e. is for output only, not i= nput. > > Before implementing the functionality of this control, i had made it a > simple edit control, because the simple edit control for my input windo= w is > working fine, but it seems this will not work for output as edit contro= ls > set their text all at once (i need to be able to send text to the contr= ol as > i need to, and have it appended) and edit controls cannot take text of = more > than one font. > > the next thing i thought of is to use the TextOut function, but i fear = this > will not be very easy, and may not be a complete solution, because i'll= need > the text to be scrollable after there is too much of it, and it needs t= o > word wrap to the size the user makes the window. > > what i have been looking at tonight is the richedit control, which may = do > the job, but i cannot find any information about how to use it using wi= n32 > api calls in c++. is richedit the way to go? if so, how do i use it? ca= n i > create one using CreateWindowEx and send it messages using SendMessage = or > specialised functions? > > this is what i would like: > HWND hOutput =3D CreateWindowEx(special edit control thingy details); > HFONT hFont =3D CreateFont(... whatever) > SendTextorSimilar(hOutput,hFont,char* text,etc...); > GetTextorSimilar(hOutput,&text,etc...); > > something along those lines. is there a control for me? is there > documentation? by control, obviously i mean a window which is going to = be a > child window of my app. also, all the functionality of the control has = to be > already written up so i can just call the functions, so does this mean = it > has to be a common control (i don't know how many of these there are)? = my > biggest fear right now is that there is no common rich text control (li= ke > there is no splitter control) and i'll have to write something myself l= ike i > wrote my splitter bar window, but it won't be so easy. > > so, anyone know how to use richedit in win32 api? > thanks > ramana > p.s. i will probably not reply to (nor receive) any replies to this mes= sage > for the next 14 days or so, because i'm going away so, yeah, (if anyone= is > interested lol) > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |