Knowledge Base

PRB: Form Scrollbar Property Read-Only at Run-Time

Article ID: 189620

Article Last Modified on 12/11/1999


APPLIES TO


This article was previously published under Q189620

SYMPTOMS

The ScrollBar property of a form is read-only during run-time if the initial value of the property is set to "0 - None". However, if you set the ScrollBar property to any non-zero value, then the property can be changed during run-time.

RESOLUTION

To change the Scrollbar property during run-time, set the property to something other than "0 - None" at design time and set the ScrollBar property to "0 - None" in the Init event of the form. This causes the form to initially run without scrollbars but with the ability to add scrollbars.

STATUS

This behavior is by design.

MORE INFORMATION

When the Scrollbar property is set to something other than "0 - None", additional system resources are used to show the scrollbars. When the ScrollBar property is set to "0 - None", these system resources are not reserved unnecessarily.

Steps to Reproduce Behavior

  1. The following code illustrates how to change the ScrollBar during run-time when the form initially runs with the ScrollBar property equal to "0 - None".
          frmScrollbar = CREATE("scrollbar")
          frmScrollbar.SHOW(1)
          *
          DEFINE CLASS SCROLLBAR AS FORM
              TOP = 13
              LEFT = 13
              HEIGHT = 176
              WIDTH = 352
              SCROLLBARS = 1 &&Any non-zero value
              DOCREATE = .T.
              CAPTION = "ScrollBar Example"
              NAME = "Form1"
    
              ADD OBJECT command1 AS COMMANDBUTTON WITH ;
                  TOP = 72, ;
                  LEFT = 180, ;
                  HEIGHT = 27, ;
                  WIDTH = 144, ;
                  CAPTION = "Change Scrollbar Prop", ;
                  NAME = "Command1"
    
              ADD OBJECT spinner1 AS SPINNER WITH ;
                  HEIGHT = 24, ;
                  LEFT = 70, ;
                  SPINNERHIGHVALUE =   3.00, ;
                  SPINNERLOWVALUE =   0.00, ;
                  TOP = 72, ;
                  WIDTH = 50, ;
                  NAME = "Spinner1"
    
              ADD OBJECT label1 AS LABEL WITH ;
                  HEIGHT = 48, ;
                  LEFT = 70, ;
                  TOP = 20, ;
                  WIDTH = 250, ;
                  WORDWRAP = .T., ;
                  CAPTION = ;
                  "Adjust the form size and then change the ;
                   ScrollBar property."
    
              PROCEDURE INIT
                  THIS.SCROLLBARS = 0
              ENDPROC
    
              PROCEDURE command1.CLICK
                  THISFORM.SCROLLBARS = THISFORM.spinner1.VALUE
              ENDPROC
    
          ENDDEFINE
    
          *-- Code ends here.

Additional query words: kbVFp600 kbOOP

Keywords: kbprb KB189620