No announcement yet.

Dumber question - REDRAW

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dumber question - REDRAW

    OK, I've read help file on the REDRAW, either for a control or a dialog. So, the
    control(s) are redraw. To what effect, are they redrawn to the initial value in the control add
    statement, the last control set "value" (does not make sense, should already be shown,
    or a whole list that has been issued by repeated control sets?? When is REDRAW used to good


  • #2
    An explicit command to redraw a window (dialog) or control is issued when you change something on the screen and don't want to wait for the normal update cycle to redraw it.

    Windows will automatically redraw a control if it needs it, e.g. if you add an item to a list control or change the text of a label control; but it only redraws when it picks up the (Low-priority) WM_PAINT message which will be at the soonest when you have exited your dialog procedure for the processing of the current message.

    So, REDRAW is used to good effect when you don't want to wait; OR when using a control or or message in which the doc tells you to issue a redraw. I don't think (but am not 100% sure) the PB doc has any such instructions, because none of the "DDT KEYWORD" ( "LABEL", "TEXTBOX", "LISTBOX" etc) controls or control statements require the programmer to manually issue a redraw. When you start getting into other controls ( "CONTROL ADD "classname"...") you could get into certain situations in which you have to issue a manual redraw.

    WARNING: you will find code here using REDRAW when the programmer is trying to do "too much" when processing a notification message. This use is actually a "hack" because when you have that much to do you should probably be using an additional thread of execution to do it. REDRAW is a cheap and dirty way to make it look like you know what you are doing.. which I guess is as good a reason as any to use it.

    The bottom line is, a properly-written "ALL DDT" program should never require an explicit redraw unless the PB help says you should do that after some statement.

    REDRAW, if issued, draws a window or control in its current state: using the last text set or entered with text controls, last selection for list controls, last location and size of the control,etc. Once a control's content changes then that is the state in which it will be redrawn. There is no "go back to original location, size and state" unless the user creates his own code to do so.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #3
      Hello Michael, thanks your for the detailed answer. I appreciate that.