PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 328 Width = 375 DoCreate = .T. Caption = "Label Autosize and Wordwrap Test" Name = "Form1" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; WordWrap = .T., ; Caption = "Here is Label1, a nice little test for you.", ; Height = 92, ; Left = 60, ; Top = 180, ; Width = 43, ; TabIndex = 10, ; BackColor = RGB(255,255,128), ; Name = "Label1" ADD OBJECT label2 AS label WITH ; AutoSize = .T., ; Caption = "Label Width:", ; Height = 17, ; Left = 12, ; Top = 72, ; Width = 70, ; TabIndex = 3, ; Name = "Label2" ADD OBJECT spinner1 AS spinner WITH ; Height = 24, ; Left = 84, ; TabIndex = 4, ; Top = 72, ; Width = 124, ; ControlSource = "thisform.label1.width", ; Name = "Spinner1" ADD OBJECT label3 AS label WITH ; AutoSize = .T., ; Caption = "Label Height:", ; Height = 17, ; Left = 5, ; Top = 108, ; Width = 75, ; TabIndex = 6, ; Name = "Label3" ADD OBJECT spinner2 AS spinner WITH ; Height = 24, ; Left = 84, ; TabIndex = 7, ; Top = 108, ; Width = 124, ; ControlSource = "thisform.label1.height", ; Name = "Spinner2" ADD OBJECT check1 AS checkbox WITH ; Top = 72, ; Left = 228, ; Height = 17, ; Width = 79, ; AutoSize = .T., ; Caption = "Word Wrap", ; ControlSource = "thisform.label1.wordwrap", ; TabIndex = 5, ; Name = "Check1" ADD OBJECT label4 AS label WITH ; AutoSize = .T., ; Caption = "Enter text:", ; Height = 17, ; Left = 12, ; Top = 12, ; Width = 55, ; TabIndex = 1, ; Name = "Label4" ADD OBJECT text1 AS textbox WITH ; ControlSource = "thisform.label1.caption", ; Height = 48, ; Left = 72, ; TabIndex = 2, ; Top = 12, ; Width = 288, ; Name = "Text1" ADD OBJECT check2 AS checkbox WITH ; Top = 108, ; Left = 228, ; Height = 17, ; Width = 68, ; AutoSize = .T., ; Caption = "Auto-size", ; ControlSource = "thisform.label1.autosize", ; TabIndex = 8, ; Name = "Check2" ADD OBJECT label5 AS label WITH ; Caption = "Label:", ; Height = 17, ; Left = 12, ; Top = 180, ; Width = 40, ; TabIndex = 9, ; Name = "Label5" ADD OBJECT command1 AS commandbutton WITH ; Top = 144, ; Left = 269, ; Height = 27, ; Width = 60, ; Caption = "Refresh", ; TabIndex = 11, ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; AutoSize = .T., ; Top = 144, ; Left = 48, ; Height = 27, ; Width = 53, ; Caption = "Widen", ; TabIndex = 12, ; Name = "Command2" ADD OBJECT command3 AS commandbutton WITH ; AutoSize = .T., ; Top = 144, ; Left = 156, ; Height = 27, ; Width = 58, ; Caption = "Narrow", ; TabIndex = 13, ; Name = "Command3" PROCEDURE spinner1.InteractiveChange store this.value to (this.controlsource) thisform.spinner2.refresh ENDPROC PROCEDURE spinner2.InteractiveChange store this.value to (this.controlsource) ENDPROC PROCEDURE spinner2.Refresh this.readonly = thisform.label1.Autosize ENDPROC PROCEDURE check1.Valid thisform.refresh() && display all side-effects ENDPROC PROCEDURE text1.InteractiveChange local adjval * replace multiple consecutive blanks with a single blank, * to avoid C00000FD errors adjval = this.value do while len(STRTRAN(m.adjval, ' ', ' ')) < len(m.adjval) adjval = STRTRAN(m.adjval, ' ', ' ') enddo * note that trim() masks the problem, unless multiple * consecutive blanks are imbedded within the label store m.adjval to (this.controlsource) thisform.spinner1.refresh thisform.spinner2.refresh ENDPROC PROCEDURE text1.Valid local adjval * replace multiple consecutive blanks with a single blank, * to avoid C00000FDs adjval = this.value do while len(STRTRAN(m.adjval, ' ', ' ')) < len(m.adjval) adjval = STRTRAN(m.adjval, ' ', ' ') enddo this.value = trim(m.adjval) * update spinners, in case this hasn't happened yet thisform.spinner1.refresh thisform.spinner2.refresh ENDPROC PROCEDURE check2.Valid thisform.refresh() && e.g. editability of height spinner ENDPROC PROCEDURE command1.Click thisform.refresh ENDPROC PROCEDURE command2.Click local initwidth, initwrap, initautosz, i, maxadd * hold on to initial label properties initwidth = thisform.label1.width initwrap = thisform.label1.wordwrap initautosz = thisform.label1.autosize if m.initautosz && auto-sizing is enabled * determine the max possible width for loop limit thisform.label1.wordwrap = .f. && force to 1 line thisform.label1.autosize = .t. && force label re-sizing maxadd = thisform.label1.width - m.initwidth * restore the initial wordwrap setting thisform.label1.wordwrap = m.initwrap else maxadd = 1 endif * add successively more width until the effect sticks for i = 1 to m.maxadd thisform.label1.width = m.initwidth + m.i if thisform.label1.width > m.initwidth exit && stop at first perceptible increase endif endfor thisform.refresh && show label width/height changes ENDPROC PROCEDURE command3.Click local initwidth, i, maxsub initwidth = thisform.label1.width && starting point if m.initwidth <= 1 && can't reduce without vanishing return && no-op - should have disabled in this case endif maxsub = m.initwidth - 1 && largest permissible reduction * add successively more width until the effect sticks for i = 1 to m.maxsub thisform.label1.width = m.initwidth - m.i if thisform.label1.width < m.initwidth exit && stop at first perceptible decrease endif endfor thisform.refresh && display label width/height changes ENDPROC ENDDEFINEAlthough this does constitute a sort of workaround, it shouldn't diminish the importance of fixing this very nasty bug. When one of these C00000FD errors strikes, the application is instantaneously obliterated. Because the problem is intermittent, it can be very hard to track down, and the remedy is awkward and imperfect. Admittedly, it's a somewhat atypical usage, but it's legitimate, and it happens to figure prominently in my own application.