Drawing lines after buttons


#1

Hello all

Sorry if this is a bit rambaling but its quite late.

Ive been using JUCE and its been great, ive run into a problem though.

basicly my program creates some buttons and some lines (works 100%)
then i create some buttons on the fly and do some math to put them into order depending on a list of there associatoin, I then try to draw a line,path or arrow to show there associations but the lines,paths etc only showup under the buttons but not anywhere else.

I know ive messed it up somewhere but could anyone give me a hint what im doing wroung?

I would attach code but theres a hell of alot of it and its a big mess.

thankyou for your help, any comment or hint appriated.

noz


#2

The cleanest way to approach that kind of thing is to use components for the lines, overriding their hitTest method to stop them getting in the way of things underneath.


#3

I did a patch interface, and drew my lines on the parent component that the objects were on. I made it harder by putting the components into tree-views, so I had to deal (sloppily) with scrolling and the tree viewport, but it worked.

The components can give you their position in relation to the parent (or underlay) component so you can translate easily.

Bruce


#4

Sorry for the trouble but I dont really understand the components for the lines bit. Could you give a line of code showing how to get a line component?

Sorry again but im a bit confused from what you mean.

Thankfully

NoZ


#5

I just mean that instead of drawing your lines in a paint() method, you should create a class of component that draws a line, and add some of those to your UI to create the lines.


#6

Or use the paintOverChildren() method of your Component which holds the buttons.