Page 1 of 1
Sample program of SimpleGraph

Posted:
January 24th, 2012, 6:25 pm
by neverush
Hi All,
I try to use code from sample program of SimpleGraph with alignment of node caption, but I'm receiving message "Incompatible types: 'TAlignment' and 'TgtTextAlignment'" - see attachment picture. What's wrong? Can you help me, please?
Re: Sample program of SimpleGraph

Posted:
January 27th, 2012, 9:47 pm
by neverush
I have some idea about my problem. There is collision between alignment as taCenter and alignment's property of different component. Problem is that I have no source code for the different component. Acc. I can change SimpleGraph only. How can I rename alignment's property as taCenter to taCenterJustify, for example. What I need to do (sorry, I'm beginner in Delphi)
Re: Sample program of SimpleGraph

Posted:
January 30th, 2012, 7:50 am
by taazz2
Don't change any value you simple add in front of the taCenter the unit name where the value you wand to use is declared.
EG.
TGraphNode(GraphObject).Alignment := SimpleGraph.taCenter;
That whould help you overcome the problem you are having now.
Re: Sample program of SimpleGraph

Posted:
January 30th, 2012, 5:07 pm
by neverush
taazz2
Thank you for your answer. But unfortunately your solution dos not work - see attachment picture (unit Simplegraph is declared). Now Delphi don't know taCenter just.
Error:
E2003 Undeclared identifier: 'taCenter'
Re: Sample program of SimpleGraph

Posted:
January 31st, 2012, 12:44 pm
by taazz2
that is because i did not do my homework before posting an answer. SimpleGraph simple uses the TAlignment type declared in classes unit that comes with delphi and does not redeclare it, so instead of SimpleGraph.taCenter you should use Classes.taCenter and yes this time around I checked that it works.
For the record you can ctrl+click on a property to take you to its declaration then ctrl+click the properties type to go to its declaration to find out where something is declared then use that unit as the example above.
Re: Sample program of SimpleGraph

Posted:
January 31st, 2012, 4:21 pm
by neverush
taazz2Thank you for answer. Your solution as Classes.taCenter works fine. -1 my problem

And ctrl+click is very useful, thanks.