Page 1 of 1

Working with Delphi Controls within a SimpleGraph

PostPosted: April 21st, 2008, 7:21 pm
by Maybel
What event handles the controls painting on a SimpleGraph?
I made a new TGraphNode, that has a TCategoryButtons inside a RoundRect Region, it draws well (the region border and the Delphi Control inside)and I can drag them fine too, but when I scroll the Graph, then the TCategoryButtons doesn't move, stays in the same position and have not found yet where painting controls is handled (not even the class that handles that), to put on that even the code I use in dragging, for moving the contorl with the RoundRect Region.
I would appreciate a lot if someone could help me
Thanks

PostPosted: April 24th, 2008, 11:50 am
by Kambiz
I think the best place to reposition your control is inside WM_VSCROLL and WM_HSCROLL windows message handlers of SG.

PostPosted: April 24th, 2008, 12:05 pm
by Maybel
thank you very much for you to reply.. I will try that ... but maybe you could tell me if is this right: I create the control into the round Rect area and then, on graggin , what I do is just MoveWindow and when I write some code in any event.. what I am trying to do is MoveWindow again.. do you think that is right??? any way will try that first
Thank you a lot

PostPosted: April 24th, 2008, 12:43 pm
by Maybel
Well I tried and it doesn't work, I guess has something to do with the fact that after WM_VSCROLL and WM_HSCROLL then is called WM_PAINT and there every control that is owned by the SG is repainted, or something like taht by RepaintControls and that procedure doesn't belong to SG but Windows. so the final result is that the SG scrolls under the controls and the control stays like before, doesn't move not even a pixel until, if I keep scrolling the window, the RoundRect region desappears of the screen, then the controls move keeping the distance reached by scrolling before... Can I send to you the code or the exe for you to see what does really happen?

PostPosted: April 25th, 2008, 6:39 am
by Kambiz
Yes please send the code. I'll try to find a solution.

PostPosted: April 25th, 2008, 8:01 pm
by Kambiz
Beside scrolling, the embedded control does not zoom with other parts of the graph.

The only solution that I can propose is to take a snapshot of the control (metafile has better quality for zooming) and draw it as the background of the node. Then, when mouse cursor is over the node, you have to redirect mouse events to the control, and probably update the snapshot. It’s lot of work I guess.

PostPosted: April 28th, 2008, 2:14 pm
by Maybel
I already sent you the source.. thank you a lot

PostPosted: April 28th, 2008, 2:22 pm
by Maybel
Oh! I have not seen the last reply you posted.. sorry, I will try and see if it behaves as I need...
Thank you a lot for your time!
I will let you know if it works