Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Cannot change hints in DiagramToolBar

 Post Reply Post Reply
Author
Fankhauser Rolf View Drop Down
New Member
New Member
Avatar

Joined: 18 May 2011
Posts: 26
Post Options Post Options   Quote Fankhauser Rolf Quote  Post ReplyReply Direct Link To This Post Topic: Cannot change hints in DiagramToolBar
    Posted: 25 Mar 2020 at 9:41am
Hi all

I register my own Diagram controls with following code (C++) but if I move over the icons in the DiagramToolBar, I see the default hints "TDiagramBlock" and "Side line" instead of "REBEKA Project" and "Side Line". What am I doing wrong?
How do I add a TDiagramBlock with shape bsEllipse in the DiagramToolBar? Is this only possible by creating a class derived from TCustomDiagramBlock and add a bitmap in atDiagram.res with a name BLK_...? I did it once 10 years ago.
From a very old version of Diagram Studio I have a Diagram Studio Reference in hlp format. Does exist a new version of this reference in chm format? That would be very helpful because of the good documentation of all components with properties and methods.

void __fastcall TForm1::FormCreate(TObject *Sender)
{

  DiagramToolBar1->Category = "MyBlocks";

  RegisterDControl(__classid(TDiagramBlock), "", "REBEKA Project", "MyBlocks");
  RegisterDControl(__classid(TDiagramLine), "", "Line", "MyBlocks");
  RegisterDControl(__classid(TDiagramSideLine), "", "Side Line", "MyBlocks");
  RegisterDControl(__classid(TTextBlock), "", "Text Block", "MyBlocks");

  DiagramToolBar1->Rebuild();
Back to Top
Fankhauser Rolf View Drop Down
New Member
New Member
Avatar

Joined: 18 May 2011
Posts: 26
Post Options Post Options   Quote Fankhauser Rolf Quote  Post ReplyReply Direct Link To This Post Posted: 25 Mar 2020 at 2:56pm
In the meantime I could answer some of my questions by myself:

- I can create a TDiagramBlock with shape bsEllipse. I used the example "Adding metafiles as block on the toolbar" from Tips and FAQs. Where do I have to place the bitmap (a circle) in order to see it in the DiagramToolBar. Now I only see the default bitmap for TDiagramBlock (a rectangle).
- But if I try to use a metafile I get a block without metafile (only link points are visible). In the example an absolute path to the metafile is used (c:\...). But this is useless for production. In an earlier version I used: ExtractFilePath(Application->ExeName) + [filename] but this is not working. I also tried filename without path but not working. I placed the metafile in the Debug folder.
I never get an error "Metafile ... not found" which would be helpful to understand what's going wrong.

Thanks, Rolf
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2888
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 25 Mar 2020 at 10:56pm
Metafiles are not supported in Direct2D, which is default drawing engine for TMS Diagram Studio.
You can force using GDI+ though:

atDiagram1.GraphicLib := dglGdiPlus;
Back to Top
Fankhauser Rolf View Drop Down
New Member
New Member
Avatar

Joined: 18 May 2011
Posts: 26
Post Options Post Options   Quote Fankhauser Rolf Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 2020 at 10:26am
Thanks Wagner!

But could you please add your hint above in the Tips and FAQs examples with metafiles. I lost some hours to try it in different ways and ask in this forum! Or is it somewhere written?
I tried to use an image list to add images to DiagramToolBar. If I add my old wmf or emf files which I used in BCB6 I only see black icons and nothing on the DiagramToolBar. Did metafile format change over time? I was successful with a png file but it looks not very nice on the DiagramToolBar. Are the default icons metafiles or bitmaps (I guess bitmaps)?
I created it with Metafile Companion. Do you know a better software to create metafiles?

Thanks, Rolf
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2888
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 2020 at 1:12pm
I will add that information, you are correct.
The icons in the toolbar must be 24x24 bitmap format. The metafile is only used to paint the block in the diagram.
Back to Top
Fankhauser Rolf View Drop Down
New Member
New Member
Avatar

Joined: 18 May 2011
Posts: 26
Post Options Post Options   Quote Fankhauser Rolf Quote  Post ReplyReply Direct Link To This Post Posted: 27 Mar 2020 at 10:32am
The hint problem disappeared after I registered additional blocks with a DControlID. It seems that the default blocks TDiagramBlock and TTextBlock disappear if corresponding blocks with a DControlID are registered.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2888
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 27 Mar 2020 at 10:02pm
Yes, that's one way to override the existing registered blocks.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down