AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Konstantenausdruck erwartet

Ein Thema von Delbor · begonnen am 26. Jan 2019 · letzter Beitrag vom 28. Jan 2019
 
Delphi.Narium

Registriert seit: 27. Nov 2017
2.600 Beiträge
 
Delphi 7 Professional
 
#2

AW: Konstantenausdruck erwartet

  Alt 26. Jan 2019, 13:05
Case geht nicht mit Variabeln, links vom Doppelpunkt muss eine Konstante stehen.
Delphi-Quellcode:
if i = 0 then ...
else if i = FRadioButtonList.Count -1 then ...
else der Rest
ist genauso flexibel wie Dein Case. Zwei Werte (1. und letztes Element) werden explizit abgefragt, der Rest geht in die Else am Ende.
Delphi-Quellcode:
procedure TRadioButtonsFrame.RadioButtonPosition;
  var i, x, y: Integer;
begin
  x := FRadioButtonList.Count - 1;
  For i := 0 to x do
  begin
    FRadioButtonList.Items[i].Left := 12;
    FRadioButtonList.Items[i].Top := 12;
    FRadioButtonList.Items[i].AlignWithMargins := true;
    FRadioButtonList.Items[i].Margins.Top := 5;
    FRadioButtonList.Items[i].Margins.Bottom := 5;
    FRadioButtonList.Items[i].Margins.Left := 80;
    FRadioButtonList.Items[i].Margins.Right := 25;
    if (i > 0) and (i < x) then FRadioButtonList.Items[i].Align := alTop;
  end;
end;
Wenn man dann noch in allen Fällen identische Codeteile nicht mehrfach aufführt, wird das schon deutlich kürzer.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz