I do not know how to change the value of the text in TextField.

Here is the entire program code:

uses FormsABC; const m_pi = 3.141592; var header := new TextLabel('Рассчет'); b1 := new FlowBreak(64); field := new RealField('Радиус:'); b2 := new FlowBreak; button := new Button('Рассчитать'); r: real; res: real; resultat := new TextLabel('Результат: пусто!'); procedure button_Click; begin var r := field.Value; if r > 0 then begin res := m_pi * r * r; writeln('[DEBUG] Площадь круга равна ', res); end else writeln('Ошибка в вычислениях: Радиус должен быть больше нуля, а он', r); end; begin MainForm.Title := 'Рассчет площади круга по его радиусу'; MainForm.SetSize(640, 480); MainForm.CenterOnScreen; button.Click += button_Click; field.FieldWidth := 500; end. 
  • why and where do you want to change it? - titov_andrei
  • @titov_andrei I need to change the resultat value inside the button_Click procedure. So that the TextLabel says "Result:" and the value res. But how to set the text, I did not find. In the PascalABC substitution, nothing is written about Text, Caption, or Value. - Craftist

1 answer 1

If you look at the source code of the "FormsABC" module, you can see that TextLabel has only the constructor and that's it. Hence the conclusion: you want to change the inscription - you need to write your class or use a text field for outputting the result, for example.