PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form Top = 0 Left = 0 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 = 144, ; Width = 43, ; TabIndex = 11, ; Name = "Label1" ADD OBJECT label2 AS label WITH ; AutoSize = .T., ; Caption = "Label Width:", ; Height = 17, ; Left = 12, ; Top = 72, ; Width = 70, ; TabIndex = 4, ; Name = "Label2" ADD OBJECT spinner1 AS spinner WITH ; Height = 24, ; Left = 84, ; TabIndex = 5, ; 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 = 7, ; Name = "Label3" ADD OBJECT spinner2 AS spinner WITH ; Height = 24, ; Left = 84, ; TabIndex = 8, ; 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 = 6, ; 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 = 9, ; Name = "Check2" ADD OBJECT label5 AS label WITH ; Caption = "Label:", ; Height = 17, ; Left = 12, ; Top = 144, ; Width = 40, ; TabIndex = 10, ; Name = "Label5" PROCEDURE text1.InteractiveChange * note that trim() masks the problem, unless multiple consecutive blanks are imbedded within the label store this.value to (this.controlsource) && update label immediately, without waiting to lose focus thisform.spinner1.refresh && display resulting label width thisform.spinner2.refresh && display resulting label height ENDPROC ENDDEFINENote that the problem only seems to occur when the label has autosize and wordwrap turned ON, and when there are multiple consecutive blanks contained in the label caption. Adding a trim() in the interactive change assignment, i.e. changing the line to this:
store trim(this.value) to (this.controlsource)removes the non-obvious trailing blanks, ameliorating the problem somewhat. However, if you position the cursor to somewhere in the middle of the text and insert/backspace repeatedly over a series of blanks, you'll quickly see the same sort of intermittent crashing behavior.