Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Excessive redrawing

Any suggestions on what would cause constant redrawing of a window?
I've been alerted to an instance of poor performance and the visual symptoms are the screen constantly redrawing itself.
The most obvious is with radio buttons. When you simply move/hover over the radio buttons, they flash, in that the text disappears and then reappears as you move across it.
You can see a video of it here
I checked the window events and there were some old scripts in both the omnievent and winmsg events for handling contextmenus so I just had them return without executing any code and there was no improvement.

I was able to get some noticeable improvement by removing the group boxes on the form (made them invisible). It was better but there's still some lag.
Look here to see what I mean

Here's the kicker and why I'm posting it here. Before it being brought to my attention, the customer had their IT people check into it and the details passed on were that whilst hovering, the cpu usage increased by about 25% and the offending components were SRP. I don't know what diagnostics tools were being used to come up with that and unfortunately at this point I don't have any more detail than that to go on so I don't know what SRP things they were pointing at and it's possibly a furfy but it's out there so I need to ask. Monitoring task manager I could see the overall cpu increase as well but not pinpoint any particular thing at fault.

There are no SRP controls on that form at all. The MDI does have an SRP ribbon, however I also ran the form direct from the application manager, so outside of the mdi and it displayed the same symptoms so I don't think that's related.

I'll try and get more info but keen to hear any suggestions on possible causes or how to better troubleshoot.

Comments

  • I've seen radio buttons behave like that. It appears that this form isn't form fixed. Would you agree? If so, try this first so we can rule that out.
  • I wasn't sure if it was form fixed or not so I fixed it.
    Alas, no improvement to the problem.
    FWIW, another symptom is the changing of the page after the tab (pushbutton) is clicked.
    It takes a few seconds to switch and you see each of the controls being drawn basically one at a time.

    How ugly is this behaviour
  • I assume the gradient background is coming from the Form Designer rather than the SRP Tab since you noted there are no SRP controls on this form. What happens if you remove the gradient background?
  • Not as extreme but same otherwise. Definitely affects controls in group boxes more than anything else.
  • Now I'm beginning to recall that tab order with group box controls can also be a problem. Just to rule these out definitively, don't just hide them but remove them and see what happens.
  • Removed them and significant, probably acceptable improvement.
    Started to put them back again and symptoms begin to reappear.

    I'm not a big fan of group boxes or excessive group boxes myself so perhaps just getting rid of them and selective implementation of picture control dividers may be the simplest answer
  • @AusMarkB
    >>picture control dividers
    What are these?
  • @BarryStevens - One of the features of the SRP Picture control is the ability to draw control parts, which are simple theme-compliant GUI elements such as divider lines. One of the horizontal divider lines support a caption so you can replace group boxes to create a cleaner and more modern UI like so:

  • and the same to you
  • @DonBakke I tried the following code but the caption is still centered, not to the left.
    What have i missed.

    Ctrl=@Window:".OLECONTROL_1"
    foo=Set_Property(Ctrl, "OLE.ControlPart", "DIV")
    foo=Set_Property(Ctrl, "OLE.Caption", "This is a caption")
    foo=Set_Property(Ctrl, "OLE.CaptionAlignment", "Top":@FM:"Left")
  • @BarryStevens, using the picture control as dividers, separators etc is the one time I use the properties box in the form designer. Everything you need is in there and it saves adding excess code to your commuter.
    It's just the simplest approach. With that in mind,here's how you would achieve what you're going for

  • edited June 2019
    Barry, I take that back. I misread your post thinking the captions were always left and you wanted them centered.

    Now that I've reread and retested, nope, they're always centered.
    Sorry for the bum steer
  • edited June 2019
    Looking at the Ole Properties for the control I saw 'HorzAlign', changed that one to left and it works.
  • With my correction out there, to achieve what you're after, a "Left" aligned caption, it's just more smoke and mirrors. Use two separate controls. One label control to serve as the caption and a Divider picture control without a caption alongside it.



    If need be, you can add a shorter picture control to the left of the label as well so it still looks like the caption is part of the same line. That way you can control exactly where you want the caption.


  • @BarryStevens,


    Yeah, that's what I really said.
  • @AusMarkB CaptionHorzAlign can give adjustment from left. I must remember that the ole properties are exposed, makes it much easier to find the correct property(s) to get what you want.
  • As noted, the OLE properties exposed in the Properties dialog sometimes do not match up with documented properties. The CaptionAlignment and Alignment properties are good examples of this. These both accept @FM delimited values but the Properties dialog does not support delimiters so we created special properties that accept just the Horizontal value or the Vertical value.

    Also as noted, the Caption can be aligned to the left. However, the Alignment property must be used rather than the CaptionAlignment property (wait...what????). Yeah...it's a bit confusing due to feature creep. The CaptionAlignment property is for a caption being used in the Picture control when it is not a ControlPart whereas the Alignment property is for a caption being used when the Picture control is a ControlPart. I'm not sure why we needed to create two properties...but it's been that way for a while.

    By the way, you can also use the CaptionOffset property to nudge the location left or right by a number of pixels. Here's how I setup my dividers:
    Ctrl = @Window : '.OLE_DIVIDER' Set_Property(Ctrl, 'OLE.ControlPart', 'Divider') Set_Property(Ctrl, 'OLE.Caption', 'Hello World') Set_Property(Ctrl, 'OLE.Alignment', 'Vertical' : @FM : 'Left') Set_Property(Ctrl, 'OLE.CaptionOffset', 0 : @FM : -5)
Sign In or Register to comment.