Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » RichEdit Questions
icon5.gif  RichEdit Questions [message #2536] Mon, 17 April 2006 03:03 Go to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
Greetings:

I have two questions to ask so here I go:

1. How do I switch the RichEdit "ColorPusher" to Null? I switch it to any other color (including Null) and it refuses to compile. (BTW I'm using the mingw 3.4.2 compiler to compile this.)

Here's the error message:

C:/upp_backup/uppsrc/RichEdit/RichEdit.lay: In function `void InitLayout(Ctrl&, L&, D&, UnitLayout__layid&) [
	with L = WithUnitLayout<TopWindow>, D = WithUnitLayout<TopWindow>]':
C:/upp_backup/uppsrc/CtrlCore/TopWindow.h:207:   instantiated from `void CtrlLayout(T&) [with T = WithUnitLay
	out<TopWindow>]'
C:/upp_backup/uppsrc/CtrlCore/TopWindow.h:215:   instantiated from `void CtrlLayout(T&, const char*) [with T 
	= WithUnitLayout<TopWindow>]'
C:/upp_backup/uppsrc/CtrlCore/TopWindow.h:221:   instantiated from `void CtrlLayoutOK(T&, const char*) [with 
	T = WithUnitLayout<TopWindow>]'
C:/upp_backup/uppsrc/CtrlCore/TopWindow.h:235:   instantiated from `void CtrlLayoutOKCancel(T&, const char*) 
	[with T = WithUnitLayout<TopWindow>]'
C:\upp_backup\uppsrc\RichEdit\Editor.cpp:266:   instantiated from here
C:/upp_backup/uppsrc/RichEdit/RichEdit.lay:46: error: 'class ColorPusher' has no member named 'SetInk'
RichEdit.icpp
1 file(s) compiled in (0:07.46) 7468 msec/file

There were errors. (1:16.84)


2. How do I make the RichEdit read from the Windows Fonts folder and use the fonts there instead of creating two fonts (Times New Roman and Courier)?

Thanks for the help. Smile Smile Smile

[Updated on: Mon, 17 April 2006 03:03]

Report message to a moderator

Re: RichEdit Questions [message #2561 is a reply to message #2536] Mon, 17 April 2006 22:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
1. I am not sure what you want to achieve. Perhaps posting the code instead of error messages would make it more clear Smile

2. RichEdit& RichEdit::FontFaces(const Vector<int>& face); - just put in the list of font faces you want to use. (See Font).

Mirek
Re: RichEdit Questions [message #2576 is a reply to message #2536] Tue, 18 April 2006 01:33 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
1. In RichEdit.lay under the UnitEdit there is a "ColorPusher" option that changes the color of the formatting symbols shown in the editor. I want to change that to Null (which is an option) however I get the errors that I described above.

I see no need to upload the RichEdit package since you should already have it if you have U++.

2. Thats good but how would I get my program to automatically detect what fonts I have then add them?

Thanks.
Re: RichEdit Questions [message #2577 is a reply to message #2576] Tue, 18 April 2006 01:39 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mentaltruckdriver wrote on Tue, 18 April 2006 00:33

1. In RichEdit.lay under the UnitEdit there is a "ColorPusher" option that changes the color of the formatting symbols shown in the editor. I want to change that to Null (which is an option) however I get the errors that I described above.

I see no need to upload the RichEdit package since you should already have it if you have U++.

2. Thats good but how would I get my program to automatically detect what fonts I have then add them?

Thanks.


Sorry about that. But could you please learn how to formulate questions? Imagine how our forums will look if everyone names topics like this? And how easy is navigation then?
Re: RichEdit Questions [message #2578 is a reply to message #2536] Tue, 18 April 2006 01:49 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
Sorry about that, I was rushing Razz

Could you please answer my question?

Thanks.
Re: RichEdit Questions [message #2579 is a reply to message #2578] Tue, 18 April 2006 01:57 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mentaltruckdriver wrote on Tue, 18 April 2006 00:49

Sorry about that, I was rushing Razz

Could you please answer my question?

Thanks.


in display example
#include "CtrlLib/CtrlLib.h"

struct FontFaceDisplay : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{
		Font fnt = Font(q, r.Height() - 2);
		String txt = Font::GetFaceName(q);
		w.DrawRect(r, paper);
		w.DrawText(r.left + 2, r.top + (r.Height() - w.GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink);
	}
};

struct MyApp : TopWindow {
	DropList dl;
	
	MyApp()
	{
		Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE));
		dl.SetDisplay(Single<FontFaceDisplay>());
		for(int i = 0; i < Font::GetFaceCount(); i++)
			dl.Add(i);
		SetRect(0, 0, 200, 70);
	}
};

GUI_APP_MAIN
{
	MyApp().Run();
}

Re: RichEdit Questions [message #2580 is a reply to message #2578] Tue, 18 April 2006 02:02 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mentaltruckdriver wrote on Tue, 18 April 2006 00:49

Sorry about that, I was rushing Razz

Could you please answer my question?

Thanks.


for the 1 errors problem please post your minimal code into "users applications in progress..." category.
And I'll rename the current topic.
Re: RichEdit Questions [message #2606 is a reply to message #2536] Tue, 18 April 2006 22:52 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
I was testing the code that you posted in the uWord example

#include "CtrlLib/CtrlLib.h"

struct FontFaceDisplay : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{
		Font fnt = Font(q, r.Height() - 2);
		String txt = Font::GetFaceName(q);
		w.DrawRect(r, paper);
		w.DrawText(r.left + 2, r.top + (r.Height() - w.GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink);
	}
};

struct MyApp : TopWindow {
	DropList dl;
	
	MyApp()
	{
		Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE));
		dl.SetDisplay(Single<FontFaceDisplay>());
		for(int i = 0; i < Font::GetFaceCount(); i++)
			dl.Add(i);
		SetRect(0, 0, 200, 70);
	}
};

GUI_APP_MAIN
{
	MyApp().Run();
}


However no matter what I do I keep getting errors when I compile. How would I incorporate this into either the UWord.cpp OR (even better) incorporate this into the line of code in RichEdit's Editor.cpp where it says:

RichEdit& RichEdit::FontFaces(const Vector<int>& ff)
{
	face.ClearList();
	for(int i = 0; i < ff.GetCount(); i++)
		face.Add(ff[i]);
	return *this;
}


Thanks for all your help so far.
Re: RichEdit Questions [message #2608 is a reply to message #2606] Tue, 18 April 2006 23:31 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
I haven't tested with all the fonts but this works:
in Editor.cpp (RichEdit package) around line 580
/*	
	ff.Add(Font::ARIAL);  //comment 3lines
	ff.Add(Font::ROMAN);
	ff.Add(Font::COURIER);
*/
//add 2 lines below ("font enumerator")
	for(int i = 0; i < Font::GetFaceCount(); i++)
		ff.Add(i);
	FontFaces(ff);

Re: RichEdit Questions [message #2626 is a reply to message #2576] Wed, 19 April 2006 09:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mentaltruckdriver wrote on Mon, 17 April 2006 19:33

1. In RichEdit.lay under the UnitEdit there is a "ColorPusher" option that changes the color of the formatting symbols shown in the editor. I want to change that to Null (which is an option) however I get the errors that I described above.

I see no need to upload the RichEdit package since you should already have it if you have U++.

2. Thats good but how would I get my program to automatically detect what fonts I have then add them?

Thanks.


1.? How you want to change it to Null? By changeing library code? Not a good idea...

2.
Vector<int> faces;
for(int i = 0; i < Font::GetFaceCount(); i++)
if(Font::GetFaceInfo(i) & Font::SCALEABLE)
faces.Add(i);
editor.FontFaces(faces);
Re: RichEdit Questions [message #2646 is a reply to message #2608] Wed, 19 April 2006 22:09 Go to previous message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
fudadmin wrote on Tue, 18 April 2006 17:31

I haven't tested with all the fonts but this works:
in Editor.cpp (RichEdit package) around line 580
/*	
	ff.Add(Font::ARIAL);  //comment 3lines
	ff.Add(Font::ROMAN);
	ff.Add(Font::COURIER);
*/
//add 2 lines below ("font enumerator")
	for(int i = 0; i < Font::GetFaceCount(); i++)
		ff.Add(i);
	FontFaces(ff);





Hey that worked! Thanks for the help there.

luzr


1.? How you want to change it to Null? By changeing library code? Not a good idea...


Never mind then, I was just wondering...

Thanks for all your help guys!
Previous Topic: QTF Justification
Next Topic: Is there a qtf page-break?
Goto Forum:
  


Current Time: Fri Apr 19 08:51:06 CEST 2024

Total time taken to generate the page: 0.02557 seconds