Prevent window refresh

[quote]
If you look closely, the window above does not resize the listbox, it simply pushes it to the right.[/quote]
I dont think thats right.
The listboxes resize… the scrollbars adjust accordingly along the bottom, and the vertial scrollbar doesnt move at all.

ps I recently tried the allowredraw code.
It hasnt helped as much as I hoped.

Jeff,

I had to modify that allowredraw code and comment out the w.refresh. That line causes the whole window to refresh/flicker. Instead I did this:

self.allowrefresh false
'reposition and resize controls...

self.allowrefresh
control1.refresh false
control2.refresh false

I still had to tweak some other things to get the results I wanted but now it’s acceptable, though still not as smooth as SourceTree.

Yeah, we’re at about the same level.
But I really dont like it even at this stage.
Not acceptable to me, but “better to light a candle than curse the darkness”, so I keep tweaking.

I feel sure that RB Studio apps didnt flicker this bad, but memory plays tricks.
I know my old Delphi apps where the controls were set to ‘fill a space’ rather than lock etc, were as smooth as silk.

Tweaks continue.

[quote=302490:@Jeff Tullin]Y
I know my old Delphi apps where the controls were set to ‘fill a space’ rather than lock etc, were as smooth as silk.
[/quote]
I wonder if they did like VB and used whats known as a “self drawn control”
Even today in the places MS doesn’t use self drawn controls they flicker like mad regardless of Windows version
If you have VS open the find dialog & resize it

Likely.
I wrote a few myself… they were much like canvas subclasses.

[quote=302487:@Jeff Tullin]I dont think thats right.
The listboxes resize… the scrollbars adjust accordingly along the bottom, and the vertial scrollbar doesnt move at all.

ps I recently tried the allowredraw code.
It hasnt helped as much as I hoped.[/quote]

Even if some aspects do resize, most of the container control does simply slide.

I believe the error for Neil’s code is to resize everything dynamically. If it was for me, I would simply push right, and resize everything only upon mouseUp.

Or use the canvas with drawrect, as I described.

Another trick I use in RubberViews is to avoid resizing at every Resizing firing, since it can happen much too frequently. In fact, I live resize every tick only. That takes flicker down.

At any rate, there is not single method. A good result comes from a combination of techniques.

Right. My problem now is the time it’s taking to resize/position the controls. When sizing fast it hops in large increments. Oh well my users would say I just wasted 8 hours and didn’t even change any functionality. Most of the users don’t resize often in this particular app. Some times 2nd best is good enough.

That is why I actually resize every 1/60th a second instead at each Resizing event. I would suggest at the minimum you do use a flag to hold calling a new resize as long as you’re not back from the routine you use to size and position the controls.

[quote]That is why I actually resize every 1/60th a second instead at each Resizing event. I would suggest at the minimum you do use a flag to hold calling a new resize as long as you’re not back from the routine you use to size and position the controls.
[/quote]

Works much smoother. Doesn’t do anything for the flicker of course. I ran this on my mac now I really realize the difference.

There is yet another strategy that should normally completely alleviate flicker, but it is a tad more complex :

  • Place a canvas on top of the ContainerControl instance on the window, same size.
  • Make it invisible
  • When you start resizing :
  • Create a picture the size of the canvas
  • DrawInto the ContainerControl instance into the picture
  • Make the canvas visible
  • In Paint, draw the picture at a scale :

g.DrawPicture(myPic, 0,0, me.width, me.height, 0, 0, myPic.width, myPic.Height)
I don’t think you need to invalidate the canvas during the resize operation. Since you modify it’s size, it should redraw automatically.

  • Resize both the canvas and the CC. But do not resize anything inside the ContainerControl
  • When resize is over (mouseUp) :
  • Resize all controls inside the ContainerControl
  • Make the canvas invisible

nice looking.[quote=302489:@Neil Burkholder]Jeff,

I had to modify that allowredraw code and comment out the w.refresh. That line causes the whole window to refresh/flicker. Instead I did this:

self.allowrefresh false
'reposition and resize controls...

self.allowrefresh
control1.refresh false
control2.refresh false

I still had to tweak some other things to get the results I wanted but now it’s acceptable, though still not as smooth as SourceTree.

[/quote]

nice looking