Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 117,577 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 2,163 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Writing a Text Editor

 
Reply to this topicStart new topic

Writing a Text Editor

LaurenceB
post 19 Jul, 2008 - 04:58 PM
Post #1


New D.I.C Head

*
Joined: 19 Jul, 2008
Posts: 6

Hi, I am looking to write a basic text editor, I am in need of help of implementing:

Formatting: Left, Right, Middle, Justify
Bold, Italic, Underline
Different Fonts
Font Sizes

I have included an attachment of what I have written so far. Any help would be greatly appreciated.

Thanks,

Laurence.

MOD EDIT: Pasted Attached Code
cpp
#include <iostream>
#include <windows.h>

using namespace std;

/* I am not sure how to implement the following code or if it works, as I have taken it from a C++ book
that I own. I am looking to write a basic text editor with some of the this code */

if (wParam == WM_KEYDOWN) {
switch (p->vkCode) {

case VK_CAPITAL: out << "<CAPLOCK>"; break;
case VK_SHIFT: out << "<SHIFT>"; break;
case VK_LCONTROL: out << "<LCTRL>"; break;
case VK_RCONTROL: out << "<RCTRL>"; break;
case VK_INSERT: out << "<INSERT>"; break;
case VK_END: out << "<END>"; break;
case VK_PRINT: out << "<PRINT>"; break;
case VK_DELETE: out << "<DELETE>"; break;
case VK_BACK: out << "<BACK>"; break;
case VK_LEFT: out << "<LEFT>"; break;
case VK_RIGHT: out << "<RIGHT>"; break;
case VK_UP: out << "<UP>"; break;
case VK_DOWN: out << "<DOWN>"; break;
case a: out << "a"; break;
case b: out << "b"; break;
case c: out << "c"; break;
case d: out << "d"; break;
case e: out << "e"; break;
case f: out << "f"; break;
case g: out << "g"; break;
case h: out << "h"; break;
case i: out << "i"; break;
case j: out << "j"; break;
case k: out << "k"; break;
case l: out << "l"; break;
case m: out << "m"; break;
case n: out << "n"; break;
case o: out << "o"; break;
case p: out << "p"; break;
case q: out << "q"; break;
case r: out << "r"; break;
case s: out << "s"; break;
case t: out << "t"; break;
case u: out << "u"; break;
case v: out << "v"; break;
case w: out << "w"; break;
case x: out << "x"; break;
case y: out << "y"; break;
case z: out << "z"; break;

default:
out << char(tolower(p->vkCode));

}
}

return CallNextHookEx(NULL, nCode, wParam, lParam);
}


Attached File(s)
Attached File  TextEditor.zip ( 745bytes ) Number of downloads: 19
User is offlineProfile CardPM

Go to the top of the page


perfectly.insane
post 19 Jul, 2008 - 05:27 PM
Post #2


D.I.C Addict

Group Icon
Joined: 22 Mar, 2008
Posts: 550



Thanked 43 times

Dream Kudos: 25
My Contributions


Perhaps you could research the Rich Text Box control that comes with Windows. That way, you won't have to implement most of the display details.
User is offlineProfile CardPM

Go to the top of the page

LaurenceB
post 20 Jul, 2008 - 02:26 PM
Post #3


New D.I.C Head

*
Joined: 19 Jul, 2008
Posts: 6

Can anyone else help me with this?
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 21 Jul, 2008 - 01:50 AM
Post #4


T3H R0XX0R!

Group Icon
Joined: 6 Feb, 2008
Posts: 3,382



Thanked 69 times

Dream Kudos: 2175

Expert In: (X)HTML, CSS, Batch Scripting, C, C++

My Contributions


To be honest, you're not gonna get too much advice without providing some code. And, if you have to ask every bit of the way, then you probably aren't ready for this yet. Start small smile.gif

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM

Go to the top of the page

born2c0de
post 21 Jul, 2008 - 03:39 AM
Post #5


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,812



Thanked 27 times

Dream Kudos: 2800

Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions


I've pasted the attached code into your post.

Don't reinvent the wheel. Use the standard controls provided by Windows such as the Rich Text Box.
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 21 Jul, 2008 - 06:26 AM
Post #6


T3H R0XX0R!

Group Icon
Joined: 6 Feb, 2008
Posts: 3,382



Thanked 69 times

Dream Kudos: 2175

Expert In: (X)HTML, CSS, Batch Scripting, C, C++

My Contributions


The way that it prints stuff looks more like a keylogger. Why would you print <CAPS> etc?

You don't have a main.
You try to return something from that, which isn't even a function.

Write some real code and we'll help.
User is offlineProfile CardPM

Go to the top of the page

polymath
post 21 Jul, 2008 - 12:06 PM
Post #7


D.I.C Regular

Group Icon
Joined: 4 Apr, 2008
Posts: 390



Thanked 4 times

Dream Kudos: 500
My Contributions


This would be super easy to program in C++ with windows forms (if you have VC++), or crossplatform with java swing (Hate to say that java would be good in at least one case... sad.gif )
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 10/7/08 08:58PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month