|
|
Home » U++ Library support » RichText,QTF,RTF... » RichEdit Questions
|
|
|
|
|
Re: RichEdit Questions [message #2579 is a reply to message #2578] |
Tue, 18 April 2006 01:57 |
|
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
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 #2606 is a reply to message #2536] |
Tue, 18 April 2006 22:52 |
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 #2646 is a reply to message #2608] |
Wed, 19 April 2006 22:09 |
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!
|
|
|
Goto Forum:
Current Time: Fri Apr 19 08:51:06 CEST 2024
Total time taken to generate the page: 0.02557 seconds
|
|
|