I’ve just found that when i call these functions the part of the container control that overlaps the locked window (or allow redraw)
doesn’t work correctly, it is not receiving mouse events as far as i can tell.
this is really annoying because i need to be able to see which row in my listbox is clicked!
And issues with layered container controls are of general interest too…
One more reason what I wish there was only the NUG… I learned a lot from the discussions there … here on average (at least outside of the Pro channel) the questions seem to trend more ‘basic’ than the NUG at it’s height. Oh well…
In any case I’m glad this got moved here, as I added it to my copy of the WFS.
Well. I agree about the nug. I used to get some good stuff on there but I think the forum is better now that I’m used to it.
I think that container controls, are probably a feature used by more advanced users but that’s not the same set as pro users. Maybe there should be a special case for people who have contributed a lot to the community, to be allowed into the pro forum. I know one of the things I learned from you was that what I thought was a pretty basic control could be made to sing.
I think he means as a high level API to freeze updates to deal with flicker on Windows without having to deal with/ know about declares and be sure you are not messing with Xojo framework operations using it.
Sorry for my sarcastic reply. Been a very long day.
I agree that it would make sense. There is a refresh so why not a lock refresh.
Its 20 lines of code and some lines in the LR and it makes a MASSIVE difference.
I mean ANY anti-flicker supported by windows apis.
I use windows many times more for development than mac, for that i have seen alot of flicker.
I just feel like it should never have been possible to even create flicker. But it happens, then i see this and think why doesn’t the framework has such build in (so you never notice flicker) or have a AutoBlockFlicker flag on some controls for example.
Have you tried using drawinto in the paint event of the window or container? I’ve seen some great results with pushbuttons and progressbars. This is one approach I use in the ActivityViewer project to help reduce flicker on Win32.
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
PushButton1.DrawInto g,PushButton1.Left,PushButton1.top
End Sub
Seems to help a lot if live resizing the window causes flicker. Doesn’t work well for listboxes though if I recall…
[quote=47326:@Russ Lunn]I’ve just found that when i call these functions the part of the container control that overlaps the locked window (or allow redraw)
doesn’t work correctly, it is not receiving mouse events as far as i can tell.
this is really annoying because i need to be able to see which row in my listbox is clicked![/quote]
i encounter problem with these code took… i have this code on the resized and resizing on my main form and i open a container control that have some code on the on open to read a table and show the record but instead of doing that, it went into a endless loop on the Open Event for the container control. Removing the code solved the problem.
Trying to remove flickering of Listbox by referring the code Russ Lunn suggested initially.
Sub LockWindow(hw as integer)
#if TargetWin32 Then
Declare Sub LockWindowUpdate Lib "user32" (ByVal hWnd As Integer)
LockWindowUpdate hw
#endif
End Sub
In my case, one Listbox in a ContainerControl under a MainWindow and flickering issue doesn’t look good, so I tried the code as following.
Tried WFS code and used SendMessage method as following, but when I run below code, I can’t see any data on Listbox and in case I click the Listbox, I just can see the updated data on the Listbox.
It seems that I am doing wrong thing. Can you advise me?
Const WM_SETREDRAW = &hB
call SendMessage( MainWindow.MainContainerScreen.JOBMonitorList.Handle, WM_SETREDRAW, 0, 0 )
// Data loading into Listbox
While Not rs.EOF
dataList.AddRow("")
For i As Integer = 1 To dataList.ColumnCount - 1
.......
Wend
call SendMessage( MainWindow.MainContainerScreen.JOBMonitorList.Handle, WM_SETREDRAW, 1, 0 )