![]() |
position vom komma
warum gibt er mir hier einen wert von 0?
Delphi-Quellcode:
Ich möchte das mir die position vom komma abhängig vom string zurückgegeben wird.
X := pos(WStyleList.ValueFromIndex[P], ',');
Ist vielleicht ValueFromIndex falsch ? Eigentlich müßte mir hier der wert 17 übergeben werden!
Delphi-Quellcode:
Kenn mich mit TStringList nicht so aus.. sorry
'WS_ACTIVECAPTION,xxx'
gruss |
Re: position vom komma
Was ist P. Steht noch mehr in der Stringliste? Was ist al Delimiter eingestellt?
|
Re: position vom komma
Zitat:
delemiter ist das komma hier die ganze procedure Sorry hätte ic hauch direkt posten können.
Delphi-Quellcode:
procedure FillList;
Var P : Integer; X : Integer; begin with WStyleList do begin Add(format('%s = $%8.8x', ['WS_BORDER', WS_BORDER])); Add(format('%s = $%8.8x', ['WS_DLGFRAME', WS_DLGFRAME])); Add(format('%s = $%8.8x', ['WS_EX_TOOLWINDOW', WS_EX_TOOLWINDOW])); Add(format('%s = $%8.8x', ['WS_THICKFRAME', WS_DLGFRAME])); Add(format('%s = $%8.8x', ['WS_DLGFRAME', WS_DLGFRAME])); end; For P := 0 To WStyleList.Count - 1 do begin X := pos(WStyleList.ValueFromIndex[P], ','); WValue.Add(AnsiMidStr(WStyleList.ValueFromIndex[P], X + 1, P)); WStyleList.ValueFromIndex[P] := AnsiMidStr(WStyleList.ValueFromIndex[P], 1, X - 1); messagebox(0, PChar(WStyleList.ValueFromIndex[P]),PChar('test'),MB_OK or MB_ICONERROR ); end; end; |
Re: position vom komma
Hallo Emil,
zuerst kommt der Suchstring, dann der zu durchsuchende String. Gruß Hawkeye |
Re: position vom komma
Zitat:
Delphi-Quellcode:
bei vb benutze ich InStr vielleicht mit pos nicht kompatible ?
X := pos(',', WStyleList.ValueFromIndex[P]);
suchende string wäre das komma(delemiter) gruss |
Re: position vom komma
Der Fehler wird eher am .ValueFromIndex leigen, ich glaube du brauchst das:
Delphi-Quellcode:
X := pos(',', WStyleList.Strings[P]);
|
Re: position vom komma
Zitat:
Gruß Hawkeye |
Re: position vom komma
Zitat:
Da kann nur null rauskommen.
Delphi-Quellcode:
gibt mir ja nur den wert von WS_BORDER zurück.
Add(format('%s = $%8.8x', ['WS_BORDER', WS_BORDER]));
addiert also nicht den ganzen string, Der eigentlich so aussehen soll.
Delphi-Quellcode:
Allerding gibt er mir dann nur den Namen nicht die Value von WS_BORDER zurück.
Add('WS_BORDER' + ',' + format('%s = $%8.8x', ['WS_BORDER', WS_BORDER]));
Muss mal schauen.. EDIT: Das wäre der richtige wert. Bin heute was neben der Rolle ;)
Delphi-Quellcode:
danke
messagebox(0, PChar(format('$%8.8x', [WS_BORDER])), PChar('test2'),MB_OK or MB_ICONERROR);
|
Re: position vom komma
Nicht hauen :duck:
Jetzt gehts! Poste das nochmal für andere die auch so ein ähnliches problem haben.
Delphi-Quellcode:
Mich wundert nur das 'WS_THICKFRAME' und 'WS_SIZEBOX' den gleichen wert besitzen
procedure FillList;
Var P : Integer; X : Integer; begin with WStyleList do begin Add('WS_BORDER' + ',' + format('$%8.8x', [WS_BORDER])); Add('WS_DLGFRAME' + ',' + format('$%8.8x', [WS_DLGFRAME])); Add('WS_EX_TOOLWINDOW' + ',' + format('$%8.8x', [WS_EX_TOOLWINDOW])); Add('WS_THICKFRAME' + ',' + format('$%8.8x', [WS_THICKFRAME])); Add('WS_SIZEBOX' + ',' + format('$%8.8x', [WS_SIZEBOX])); end; For P := 0 To WStyleList.Count - 1 do begin X := pos(',',WStyleList.Strings[P]); WValue.Add(AnsiMidStr(WStyleList.Strings[P], X + 1, strlen(PChar(WStyleList.Strings[P])))); WStyleList.Strings[P] := AnsiMidStr(WStyleList.Strings[P], 1, X - 1); messagebox(0, PChar(WValue.Strings[p]),PChar('test'),MB_OK or MB_ICONERROR ); end; end; schon seltsam ... Das convertieren der Variablen in Delphi nervt ganz schön ;) Sehe bald vor lauter Klammern den Wald(Source) nicht mehr :mrgreen: gruss |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:30 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 by Thomas Breitkreuz