Results 1 to 15 of 15

Thread: Getal uit een string halen

  1. #1

    Angry Getal uit een string halen

    als ik dit lijstje heb in mijn checkbox;

    artikel1, 29,0
    artikel2 , 30
    artikel3, 40

    en ik spreek de eerste waarde aan met;
    Code:
    for t:= checklistbox1.Items.count-1  downto  0 do
             if CheckListBox1.Checked[t] and (checklistbox1.Items.count > 0) then
             artikel := Integer(checklistBox1.Items.Objects[checklistbox1.Items.IndexOf(p)]) ;
              edit2.Text:=inttostr(prijs);
    dan krijg ik als error dat artikel1 geen integer is...
    Goed hoe filter ik de prijs eruit???
    is er een member van checklistbox dat alleen de integer (29,0) eruit haalt??? van de regel artikel1, 29,0

  2. #2
    Het is inderdaad geen integer, maar een string. Je zult die string dus moeten gaan ontleden. Dat kan in dit geval door de string te splitsen op de komma's. Dat is wel even wat werk, maar gelukkig is dat onderwerp al regelmatig besproken op NLDelphi.

    Een andere mogelijkheid, eerder ook al aangedragen door Henkie, is om de getallen op te slaan in de objects die je aan elk item kunt hangen. Op die manier sla je het getal los op, gescheiden van de string.
    1+1=b

  3. #3

    heb tijdelijke oplossing

    Code:
    procedure TForm1.ButtonaddClick(Sender: TObject);
    var   item, winkel, koper: string;  prijs:integer;
    var tel:integer;
    begin
      Item := edit1.Text;
      Prijs := StrToInt(edit2.text);
      winkel :=edit4.text;
      CheckListBox1.Items.Add(item + ',' + IntToStr(prijs) + ',' + winkel);
      //of je schrijft het zonder prijs eerst om te zetten van string naar integer
      //om daarna terug om te zetten naar string, te omslachtigend;
      tel:= strtoint(edit5.Text)+strtoint(edit2.Text);
    edit5.Text:=inttostr(tel);
    end;
    Maar om het programma goed te kunne gebruiken moet ik ook geladen files kunnen optellen en niet alleen add functie items. Dus wil toch op een of andere manier de prijs uit die checkbox filteren...kan kunnen jullie me een klein beetje op weg helpen welke procedure of functie geschikt is??

  4. #4
    Je zal de strings moeten parsen door Copy, Pos, StrToint ed te gebruiken.
    Mocht je de werking daarvan niet kennen --> Delphi basics
    DeX 3 Delphi := The ease of VB with the power of C; Zoekt en gij zult vinden

  5. #5

    fouten bij parsen

    Code:
       procedure tform1.ParseDelimited(const sl : TStrings; const value : string; const delimiter : string) ;
    var
       dx : integer;
       ns : string;
       txt : string;
       delta : integer;
    begin
       delta := Length(delimiter) ;
       txt := value + delimiter;
       sl.BeginUpdate;
       sl.Clear;
       try
         while Length(txt) > 0 do
         begin
           dx := Pos(delimiter, txt) ;
           ns := Copy(txt,0,dx-1) ;
           sl.Add(ns) ;
           txt := Copy(txt,dx+delta,MaxInt) ;
         end;
       finally
         sl.EndUpdate;
       end;
    end;
    
    
    
    procedure TForm1.Button1Click(Sender: TObject);
    var i:integer;
    begin
      showmessage(checklistbox1.Items.GetText);
      ParseDelimited(checklistbox1.items.gettext, (checklistbox1.items.gettext),';');
    end;
    errors;
    [Pascal Error] checklistboxparse.pas(111): E2010 Incompatible types: 'TStrings' and 'PAnsiChar'ik heb op google en nldelphi gezocht maar vond geen manier om pansichar om te zetten naar tstring of string kan dat wel??
    of tstrings naar string


    [Pascal Error] checklistboxparse.pas(114): E2033 Types of actual and formal var parameters must be identical
    Last edited by anthony68; 05-Jun-08 at 12:46.

  6. #6
    Quote Originally Posted by anthony68 View Post
    ik heb op google en nldelphi gezocht maar vond geen manier om pansichar om te zetten naar tstring of string kan dat wel??
    Weet je het zeker? Als ik op NLDelphi zoek naar 'PAnsichar naar string', dan vind ik 'm toch wel degelijk. O.a. deze, maar er zijn er meer.
    1+1=b

  7. #7
    Er is overigens een verschil tussen TStrings en een string. String is een native type dat een reeks van tekens voorstelt, vergelijkbaar met PAnsiChar, maar dan met een beetje meer.

    TStrings is een basis class voor een lijst van strings. Deze class wordt als basis gebruikt voor TStringList en voor de Lines en Items property van diverse controls.
    Deze zijn niet compatible met elkaar, al heeft TStrings wel een Text property waarmee je de hele inhoud van alle strings in één string terugkrijgt.
    1+1=b

  8. #8
    PChar(stringUrl) dit bedoel ik maar dan omgekeerd kan niets vinden

  9. #9
    Nou, opdezelfde manier:
    Code:
    string(pcharvariabele)
    1+1=b

  10. #10
    Hallo,

    Haal op http://www.geocities.com/ericdelphi/StrMan.html StringManager op.
    In het volgende voorbeeld gebruik ik een tweetal functies uit de StringManager.

    Code:
    procedure TForm1.Button1Click(Sender: TObject);
    Var
       S : String;
    
    begin
      S:='Artikel1, 29,0';
      S:=Sm.Purge(S,['A'.. 'z']);           // ===>  '1, 29,0'
      Label1.Caption:=Sm.After(',',S);      // ===>  '29,0'
    end;

    Opmerking: 29,0 is een string.

  11. #11
    als ik jouw methode doe krijg ik deze errors;
    Code:
    [Pascal Warning] StrMan.pas(843): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(843): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(868): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(899): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(899): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(923): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(945): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(958): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(1162): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(1229): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(2147): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2148): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2153): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2180): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2181): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2191): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2461): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2477): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(2477): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(2701): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2705): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2746): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2852): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2860): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2909): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2931): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2948): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(2964): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3018): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3154): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3778): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3811): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3874): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(3942): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(3944): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(3946): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(3947): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(4050): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4055): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4080): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4082): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4171): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4172): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4197): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4198): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4247): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4275): W1047 Unsafe code 'String index to var param'
    [Pascal Error] StrMan.pas(4510): E2003 Undeclared identifier: 'VarToDateTime'
    [Pascal Warning] StrMan.pas(4617): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4623): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4624): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4633): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(4633): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4636): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4636): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4637): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(4637): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4643): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4643): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(4644): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(4644): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(5082): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(5097): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(5112): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(5998): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6002): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6004): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6083): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6089): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6092): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6094): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6173): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6350): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6362): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6381): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6493): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6493): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6494): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6496): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6499): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6499): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6508): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6510): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6516): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6516): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6517): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6519): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6520): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6520): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6521): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6522): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6522): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6561): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6572): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6572): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(6576): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6578): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6605): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6621): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6624): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6814): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6820): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6820): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6821): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6843): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6850): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6851): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6851): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6945): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6952): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6953): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6961): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6965): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6967): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(6989): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(6995): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7000): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7003): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7006): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7008): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7010): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7038): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7055): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7114): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7142): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7157): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7162): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7238): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7239): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7251): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7262): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7283): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7287): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7288): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7356): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7357): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7369): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7380): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7400): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7404): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7405): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7632): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7638): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7644): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7650): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7660): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7665): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7690): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7696): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7698): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7698): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7699): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7699): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7711): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7718): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7720): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7721): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7721): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7728): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7735): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7741): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7743): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7743): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7752): W1047 Unsafe code '^ operator'
    [Pascal Warning] StrMan.pas(7799): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7800): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7836): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7837): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7854): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7856): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7861): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(7880): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7918): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7946): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7946): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7958): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7964): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7980): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7985): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7988): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(7993): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8009): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8016): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8021): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8031): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8055): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8061): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8069): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8107): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8194): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8299): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8369): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8461): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8481): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8483): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8487): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8536): W1047 Unsafe code 'String index to var param'
    [Pascal Warning] StrMan.pas(8565): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8619): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8622): W1047 Unsafe code 'ASM'
    [Pascal Warning] StrMan.pas(8853): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8854): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8859): W1047 Unsafe code '@ operator'
    [Pascal Warning] StrMan.pas(8875): W1047 Unsafe code '@ operator'
    [Pascal Fatal Error] loadfilewerkt.pas(6): F2063 Could not compile used unit 'StrMan.pas'
    in stringmanager..

  12. #12
    John Kuiper
    Join Date
    Apr 2007
    Location
    Almere
    Posts
    8,747
    Anthony, de stringmanager is wel leuk, maar vraag mij af of er functies in zitten, die wel voor jouw toepassing zijn. Je kan het beter eerst structueel oplossen met eigen code, dan met third party tools. Natuurlijk is het mooi dat zulke componenten bestaan, maar het brengt je niet verder (in ieder geval op dit moment niet).
    Delphi is great. Lazarus is more powerfull

  13. #13

  14. #14
    Hallo,

    Ik heb dat nog even nagegaan. Ik begrijp niet het probleem dat jij vindt door gebruik te maken van StringManager. Wat ik me wel afvraag is waarom je een CheckListBox gebruikt als je een waarde in Edit2.Text wil zetten. Als je meer waarden in de CheckListBox aanvinkt dan krijg je niet de gewenste waarde in Edit2. Ik neem aan dat je via een selectie in CheckListBox de waarde moet kunnen aanpassen. Ik heb in werkend voorbeeld gemaakt. Dit geeft geen foutmeldingen met StrMan;

    Code:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, CheckLst, StrMan;
    
    type
      TForm1 = class(TForm)
        CheckListBox1: TCheckListBox;
        Edit1: TEdit;
        Label1: TLabel;
        procedure CheckListBox1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.CheckListBox1Click(Sender: TObject);
    Var
       T       : Integer;
       Artikel : String;
       Prijs   : String;
    
    Begin
      For T:= CheckListBox1.Items.Count-1  DownTo  0 do
        If CheckListBox1.Checked[T] then
        Begin
          Artikel:=CheckListBox1.Items.Strings[T];
          Prijs:=Sm.Purge(Artikel,['A'..'z']);
          Prijs:=Sm.After(',',Prijs);
          Artikel:=Sm.Before(',',Artikel);
          Label1.Caption:=Artikel;
          Edit1.Text:=Prijs;
        End;
    End;
    
    End.

  15. #15

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •