BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

symbol or graphic in memofield

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Emiel Peeters
Guest





PostPosted: Fri Sep 08, 2006 8:11 am    Post subject: symbol or graphic in memofield Reply with quote



Hi,

I'm using a memofield component to show a lot of numbers in a list. Now I
want to be able to put in 2 very simple graphics; Is this possible?

Or is there a posibility to create a new symbol which I can put in the memo
field? Or should I use another component?

Any suggestions,

Anthony
Back to top
JD
Guest





PostPosted: Fri Sep 08, 2006 10:06 pm    Post subject: Re: symbol or graphic in memofield Reply with quote



"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:
Quote:

I'm using a memofield component [...] I want to be able to
put in 2 very simple graphics; Is this possible?

If you mean a TMemo, then yes but it's a hack to say the least.

Quote:
Or is there a posibility to create a new symbol which I can
put in the memo field?

A glyph is a glyph.

Quote:
Or should I use another component?

Yes. I would suggest that you a TRichEdit instead.

~ JD
Back to top
Peter Below (TeamB)
Guest





PostPosted: Fri Sep 08, 2006 11:01 pm    Post subject: Re: symbol or graphic in memofield Reply with quote



Emiel Peeters wrote:

Quote:
Hi,

I'm using a memofield component to show a lot of numbers in a list.
Now I want to be able to put in 2 very simple graphics; Is this
possible?

If you are referring to a TDBMemo or equivalent the answer is no, this
control displays only plain text. You may want to look at the TDBChart
component, it allows you to display a variety of charts based on data
from a table. You could also use a normal TChart (not data bound) to
construct the chart in code in the datasets AfterScroll event.

For questions on these components use the b.p.delphi.reporting-charting
group.

--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Back to top
Emiel Peeters
Guest





PostPosted: Mon Sep 11, 2006 8:11 am    Post subject: Re: symbol or graphic in memofield Reply with quote

Now I changed the component in a TRichEdit. But what is the right way to
insert a new symbol? In what should I create the symbol?

"JD" <nospam (AT) nospam (DOT) com> schreef in bericht
news:4501a328$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:

I'm using a memofield component [...] I want to be able to
put in 2 very simple graphics; Is this possible?

If you mean a TMemo, then yes but it's a hack to say the least.

Or is there a posibility to create a new symbol which I can
put in the memo field?

A glyph is a glyph.

Or should I use another component?

Yes. I would suggest that you a TRichEdit instead.

~ JD
Back to top
JD
Guest





PostPosted: Mon Sep 11, 2006 6:35 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:
Quote:

I changed the component in a TRichEdit. But what is the
right way to insert a new symbol?

The easiest way is to get glyph into the clipboard and then use the PasteFromClipboard method.

Quote:
In what should I create the symbol?

Use Paint to create a bitmap that you can add as a resourse.

~ JD
Back to top
Emiel Peeters
Guest





PostPosted: Tue Sep 12, 2006 4:23 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

I created a bitmap and I'm trying to load it in from a file onto the
clipboard but I've read in the help that I need to register it or some
thing.

Do you happen to have an example for this besides the one in the delphi
help?

Thanks,

Anthony

"JD" <nospam (AT) nospam (DOT) com> schreef in bericht
news:4505663d$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:

I changed the component in a TRichEdit. But what is the
right way to insert a new symbol?

The easiest way is to get glyph into the clipboard and then use the
PasteFromClipboard method.

In what should I create the symbol?

Use Paint to create a bitmap that you can add as a resourse.

~ JD
Back to top
JD
Guest





PostPosted: Tue Sep 12, 2006 9:47 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:
Quote:

I created a bitmap and I'm trying to load it in from a file
onto the clipboard

Use the TClipboard's Assign method.

~ JD
Back to top
Peter Below (TeamB)
Guest





PostPosted: Tue Sep 12, 2006 10:25 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

Emiel Peeters wrote:

Quote:
I created a bitmap and I'm trying to load it in from a file onto the
clipboard but I've read in the help that I need to register it or
some thing.

If you have a TBitmap you can copy it to the clipboard with the
statement

Clipboard.Assign(theBitmap);

Add Clipbrd to your Uses clause.


--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Back to top
Emiel Peeters
Guest





PostPosted: Thu Sep 14, 2006 8:11 am    Post subject: Re: symbol or graphic in memofield Reply with quote

I ceated this:
procedure TForm1.Button1Click(Sender: TObject);
var
haak : TBitmap;
begin
haak:=TBitmap.Create;
try
haak.LoadFromFile('test.bmp');
Clipboard.Assign(haak);
RichEdit1.PasteFromClipboard;
finally
haak.free;
end;
end;

I don't get any errors or warning, but when I press the button, nothing
happens. I made the bitmap visual in a Timage component and this works,
Where did I go wrong? Thanks for all your help,

Anthony

"Peter Below (TeamB)" <none> schreef in bericht
news:xn0er534z13amj001 (AT) newsgroups (DOT) borland.com...
Quote:
Emiel Peeters wrote:

I created a bitmap and I'm trying to load it in from a file onto the
clipboard but I've read in the help that I need to register it or
some thing.

If you have a TBitmap you can copy it to the clipboard with the
statement

Clipboard.Assign(theBitmap);

Add Clipbrd to your Uses clause.


--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Back to top
Nicholas Sherlock
Guest





PostPosted: Thu Sep 14, 2006 8:11 am    Post subject: Re: symbol or graphic in memofield Reply with quote

Emiel Peeters wrote:
Quote:
I ceated this:
procedure TForm1.Button1Click(Sender: TObject);
var
haak : TBitmap;
begin
haak:=TBitmap.Create;
try
haak.LoadFromFile('test.bmp');
Clipboard.Assign(haak);
RichEdit1.PasteFromClipboard;
finally
haak.free;
end;
end;

I don't get any errors or warning, but when I press the button, nothing
happens. I made the bitmap visual in a Timage component and this works,
Where did I go wrong? Thanks for all your help,

Perhaps you need TPicture for clipboard support. Try replacing TBitmap
with TPicture.

Note that the user will *not* appreciate the contents of their clipboard
being destroyed.

Cheers,
Nicholas Sherlock

--
http://www.sherlocksoftware.org
Back to top
Peter Below (TeamB)
Guest





PostPosted: Thu Sep 14, 2006 10:15 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

Emiel Peeters wrote:

Quote:
I ceated this:
procedure TForm1.Button1Click(Sender: TObject);
var
haak : TBitmap;
begin
haak:=TBitmap.Create;
try
haak.LoadFromFile('test.bmp');
Clipboard.Assign(haak);
RichEdit1.PasteFromClipboard;

The last line above simply does not do what you expect it to do, it
pastes only text.

Inserting a bitmap into a richedit requires use of the OLE support
build into the MS rich edit common control. Unfortunately the TRichedit
class does not surface this stuff, so one has to go native, which is a
bit messy. I never looked into this, but there was an article in The
Delphi Magazine back in the last millenium that showed how to do it:

TRichEdits And Embedded Objects
Authors: Brian Long
Issue 52 : Dezember 1999
Summary
Brian Long demonstrates how the standard Windows rich edit control,
encapsulated in Delphi's TRichEdit
component, can be used to display bitmaps through the wonders of OLE.
Keywords
TRichEdit; Embedding objects; Graphics in TRichEdits; Rich text;
Bitmaps in rich text; OLE objects;
IRichEditOLECallback; em_SetOleCallback; safecall and stdcall;
TInterfacedObject;
CreateIBytesOnHGlobal; StgCreateDocfileOnILockBytes; IStorage;
IOleInPlaceFrame; OleCtnrs unit;
TOleInPlaceFrameInfo; IVCLFrameForm; GetVCLFrameForm; OleFormObject;
In-place editing; Editing
OLE object

Go to www.thedelphimagazine.com and download the companion disk for the
issue, there should be some relevant code samples on it. Or get the
Collection CD for the article.

There are also some enhanced rich edit classes around. Some old URLs i
have around:

RichEdit with graphics MYOLE91.ZIP
http://sunsite.icm.edu.pl/delphi/index.htm

http://www.swissdelphicenter.ch/en/showcode.php?id=1332

--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Back to top
JD
Guest





PostPosted: Sat Sep 16, 2006 8:11 am    Post subject: Re: symbol or graphic in memofield Reply with quote

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:
Quote:

I don't get any errors or warning, but when I press the
button, nothing happens.

Sorry for misleading you. This link will work:

http://www.swissdelphicenter.ch/en/showcode.php?id=1332

You can also accomplish what you want by sending the TRichEdit
an EM_GETOLEINTERFACE message to get an IRichEditOle interface
pointer and then call its InsertObject() method but I couldn't
google a good sample and Tamarack has been down for a couple
of days now.

~ JD
Back to top
Bryan Valencia
Guest





PostPosted: Fri Sep 22, 2006 1:57 am    Post subject: Re: symbol or graphic in memofield Reply with quote

Actually don't use the clipboard, your users will hate you. They will think
there is some other data out there and you're replacing it.

With a TRichEdit, the best thing to do is use a glyph that is a character in
one of the Windows Fonts. Marlett, Webdings and Wingdings provide a lot of
these. You can tell the richedit:

- at this point, put in a change to this font and color and size,
- put in the character that represents the glyph
- change font and color back to what it was before.

I would avoid using a downloaded font, because all users will need to have
this font installed to use your program.

Of course if you MUST have your custom glyph, this will not help.


"JD" <nospam (AT) nospam (DOT) com> wrote in message
news:4505663d$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:

I changed the component in a TRichEdit. But what is the
right way to insert a new symbol?

The easiest way is to get glyph into the clipboard and then use the
PasteFromClipboard method.

In what should I create the symbol?

Use Paint to create a bitmap that you can add as a resourse.

~ JD
Back to top
Emiel Peeters
Guest





PostPosted: Mon Sep 25, 2006 4:27 pm    Post subject: Re: symbol or graphic in memofield Reply with quote

I'm getting an error on this:
GetDIB(pict.Handle, pict.Palette, PChar(bi)^, PChar(bb)^);
[Error] Unit1.pas(100): Invalid typecast
What can it be?

Thanks, Anthony


"JD" <nospam (AT) nospam (DOT) com> schreef in bericht
news:450b9094$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:

I don't get any errors or warning, but when I press the
button, nothing happens.

Sorry for misleading you. This link will work:

http://www.swissdelphicenter.ch/en/showcode.php?id=1332

You can also accomplish what you want by sending the TRichEdit
an EM_GETOLEINTERFACE message to get an IRichEditOle interface
pointer and then call its InsertObject() method but I couldn't
google a good sample and Tamarack has been down for a couple
of days now.

~ JD
Back to top
JD
Guest





PostPosted: Thu Sep 28, 2006 12:50 am    Post subject: Re: symbol or graphic in memofield Reply with quote

"Emiel Peeters" <Anthony.Jacqmain (AT) foehrenbach (DOT) be> wrote:
Quote:

I'm getting an error on this:
GetDIB(pict.Handle, pict.Palette, PChar(bi)^, PChar(bb)^);
[Error] Unit1.pas(100): Invalid typecast
What can it be?

The only casting that you're doing is with the last 2
parameters so it has to be that. I looked in the help
(C++ help) and those 2 parameters are declared as void
pointers (uncasted) so if you remove the cast, it should
compile:

GetDIB(pict.Handle, pict.Palette, bi^, bb^);

However, I converted the code to C++ and couldn't get it to
work! I might be missing something but I don't think so.

I was able to paste images using IRichEditOle with sample
code from:

http://home.att.net/~robertdunn/Yacs.html

Look for a section titled Add OLE functionality to TRichEdit (TRichEditOle & TRichEditOleCallback classes)
and download the zip. Robert Dunn is a wizard with TRichEdit
but (like me) he doesn't do Delphi so you'll need to convert
the code.

I also found a Delphi sample that uses IRichEditOle but I have
not tested it:


http://groups.google.com/group/borland.public.delphi.vcl.components.writing/msg/4e1e2fd01b237381?hl=en&

~ JD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.