case s of
'1' end допускаются символы в case по строкам
This commit is contained in:
parent
a4804f31a3
commit
5404728fdb
|
|
@ -8,23 +8,37 @@ begin
|
|||
tb.FontSize := 30;
|
||||
var x := IntegerBox('X:');
|
||||
var y := IntegerBox('Y:');
|
||||
x.Value := Random(0,10);
|
||||
y.Value := Random(0,10);
|
||||
|
||||
var cb := new ComboBoxWPF('Операция');
|
||||
cb.AddRange('+','-','*','/');
|
||||
|
||||
var count := 0;
|
||||
var sb := StatusBar;
|
||||
sb.Text := 'Количество вычислений: ' + count;
|
||||
|
||||
var b := Button('+');
|
||||
b.Click := procedure -> begin
|
||||
case cb.SelectedString of
|
||||
string('+'): tb.Println($'{x.Value} + {y.Value} = {x.Value + y.Value}');
|
||||
string('-'): tb.Println($'{x.Value} - {y.Value} = {x.Value - y.Value}');
|
||||
string('*'): tb.Println($'{x.Value} * {y.Value} = {x.Value * y.Value}');
|
||||
string('/'): tb.Println($'{x.Value} / {y.Value} = {x.Value / y.Value}');
|
||||
case cb.SelectedText of
|
||||
'+': tb.Println($'{x.Value} + {y.Value} = {x.Value + y.Value}');
|
||||
'-': tb.Println($'{x.Value} - {y.Value} = {x.Value - y.Value}');
|
||||
'*': tb.Println($'{x.Value} * {y.Value} = {x.Value * y.Value}');
|
||||
'/': tb.Println($'{x.Value} / {y.Value} = {x.Value / y.Value}');
|
||||
end;
|
||||
x.Value := Random(0,10);
|
||||
y.Value := Random(0,10);
|
||||
count += 1;
|
||||
sb.Text := 'Количество вычислений: ' + count;
|
||||
end;
|
||||
|
||||
Button('Очистить').Click := () -> begin
|
||||
count := 0;
|
||||
sb.Text := 'Количество вычислений: ' + count;
|
||||
tb.Clear;
|
||||
end;
|
||||
|
||||
cb.SelectionChanged := procedure -> begin
|
||||
b.Text := cb.SelectedString
|
||||
b.Text := cb.SelectedText
|
||||
end;
|
||||
end.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
// Модуль Controls - StatusBar
|
||||
uses Controls,WPFObjects;
|
||||
|
||||
// Управление свойствами объекта, связанными с перемещением и поворотом.
|
||||
// В OnDrawFrame объект сам себя перерисовывает
|
||||
begin
|
||||
Window.Title := 'Модуль Controls - StatusBar';
|
||||
var l := LeftPanel(180,Colors.Orange);
|
||||
|
||||
var c := new RectangleWPF(50,200,80,50,Colors.Green);
|
||||
c.Direction := (1,0);
|
||||
c.Velocity := 0;
|
||||
c.Tag := 0; // скорость поворота
|
||||
|
||||
OnDrawFrame := dt -> begin
|
||||
c.MoveTime(dt);
|
||||
c.RotateAngle += integer(c.Tag) * dt;
|
||||
end;
|
||||
|
||||
Button('Начать перемещение').Click := procedure -> begin
|
||||
c.Velocity := 30;
|
||||
end;
|
||||
Button('Закончить перемещение').Click := procedure -> begin
|
||||
c.Velocity := 0;
|
||||
end;
|
||||
Button('Начать поворот').Click := procedure -> begin
|
||||
c.Tag := 30;
|
||||
end;
|
||||
Button('Закончить поворот').Click := procedure -> begin
|
||||
c.Tag := 0;
|
||||
end;
|
||||
end.
|
||||
|
|
@ -10583,6 +10583,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
foreach (SyntaxTree.expression expr in cv.conditions.expressions)
|
||||
{
|
||||
expression_node cn = convert_strong(expr);
|
||||
if (cn.type == SystemLibrary.SystemLibrary.char_type)
|
||||
cn = convertion_data_and_alghoritms.convert_type(cn, SystemLibrary.SystemLibrary.string_type);
|
||||
if (cn.type != SystemLibrary.SystemLibrary.string_type)
|
||||
AddError(new CanNotConvertTypes(cn, cn.type, SystemLibrary.SystemLibrary.string_type, cn.location));
|
||||
string_const_node scn = convert_string_const_to_switch(cn, cn.location);
|
||||
|
|
|
|||
|
|
@ -404,6 +404,8 @@ type
|
|||
begin
|
||||
Result := (Left < 0) or (Top < 0) or (Right > GraphWindow.Width) or (Bottom > GraphWindow.Height);
|
||||
end;
|
||||
/// Tag хранит любые присоединённые характеристики объекта
|
||||
auto property Tag: object;
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue