drawing order canvas+embedded controls

Hi all,

I have a canvas with embedded controls and I like to draw a simple scrollbar inside but the
drawing event is overwritten by the controls.
Stupid question but what is the drawing order and how can I get the scrollbar (or anything you paintinthere)
to be overlayed ?

Probably best advice is ‘dont embed the controls’.

if you lay them out on a Window and they dont overlap, it will work fine.

If you need a border, draw a rectangle in the WIndow’s Paint event?

You might also consider putting a second canvas next to the first one in which you will draw the scroll bar. If you get the locking right, no one will see it.

Is there a reason you’re not using a scroll bar control?

@ Jeff

If I don’t embedd I am not able to scroll any content right ?

@ Greg,

I actually wanted to create a single canvas with scrolling bars which are MacOS like (overlay) and though it would be better to control everything in one canvas instead of subclassing and honestly, I saw Sam Rolands piDogScrollBar+Layers and thought I could make that too. :slight_smile:
Anyway. I finally ended up using a second canvas for the vscroller with the right lock, otherwise the scroller gets scrolled too.

This looks quite good but if I would know how to get all my stuff in a NSScrollView, I would feel way more happy instead of using a custom scroller.

This took a lot of work to accomplish gosh but I am open for any sugestions. Note the behavior of cells gettinga out of
view and adjusted again.

custom listbox w/ custom overlay scroller

[quote]@ Jeff

If I don’t embedd I am not able to scroll any content right ?[/quote]

Wrong.
You just change the .left properties of the controls you want to scroll.
An easy way to do that is to set the .tag property to the original LEFT
Then when the scrollbar is changed, set the .LEFT property to control.TAG - Scrollbar1.value

@ Jeff

Can you show me an example ?

start a project
Add a property to the window : startPos (integer)

Add a bevel button
Add a scrollbar, set it to live scroll = yes

In the window.open() event

StartPos = 0 // the starting value of the scrollbar

In the ScrollBar ValueChanged event, add this:

BevelButton1.left = BevelButton1.left - (me.value - self.startpos) self.startpos = me.value