X := StrToFloat(Trim(DdeClientItem.Text));
«il faut s'assurer que toutes les données ont été transmise en effet il réagit dés le premier caractère transmis»
unit DDE; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DdeMan, Buttons, Unit2, ExtCtrls, OleCtrls, Chartfx3, VCFI, ComCtrls, Gauges; type TForm1 = class(TForm) BIDServeur: TDdeClientConv; BIDClient: TDdeClientItem; GroupBox1: TGroupBox; GroupBox2: TGroupBox; GroupBox3: TGroupBox; ComboDevise: TComboBox; LblBalance: TEdit; GroupBox4: TGroupBox; GroupBox5: TGroupBox; Label1: TLabel; highServeur: TDdeClientConv; highClient: TDdeClientItem; lowserveur: TDdeClientConv; Lowclient: TDdeClientItem; Gauge1: TGauge; ComboPaires: TComboBox; AskServeur: TDdeClientConv; AskClient: TDdeClientItem; procedure BIDClientChange(Sender: TObject); procedure ComboPairesChange(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form1 : TForm1; Current : Extended; High : Extended; Low : Extended; Ask : Extended; Coef : integer; Sto : integer; StoTxt : String; SpreadTxt: String; implementation {$R *.dfm} //change la paire à appeller dans les Dde.item procedure TForm1.ComboPairesChange(Sender: TObject); begin BidClient.DdeItem := combopaires.Text; AskClient.DdeItem := combopaires.Text; HighClient.DdeItem := combopaires.Text; lowclient.DdeItem := combopaires.Text; GroupBox5.Caption := combopaires.Text; end; // change le texte pour les prix, spreads et crée une gauge procedure TForm1.BIDClientChange(Sender: TObject); begin Label1.Caption := BidClient.Text; DecimalSeparator := '.'; Current := StrToFloatDef(bidClient.Text, 0.0); High := StrToFloatDef(highClient.Text, 0.0); Low := StrToFloatDef(lowclient.Text, 0.0); Ask := StrToFloatDef(askclient.Text, 0.0); Sto := round(((Current-Low)/(High-Low))*100); coef := 10000; //ajouter conditions pour que le coef soit de 100 pour les JPY SpreadTxt:= FloatToStr(Current-Ask*coef); StoTxt := FloatToStr(Sto); GAUGE1.MinValue:= 0; gauge1.MaxValue:= 100; gauge1.Progress:= Sto; end; {Tranformation des données reçues pour en faire des calculs} end.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar Form1: TForm1; Current, High , Low, Ask : Extended; Sto : integer; StoTxt, SpreadTxt : String;
{change la paire à appeller dans les Dde.item} procedure TForm1.ComboPairesChange(Sender: TObject); begin With ComboPaires Do Begin BidClient.DdeItem := Text; AskClient.DdeItem := Text; HighClient.DdeItem := Text; lowclient.DdeItem := Text; GroupBox5.Caption := Text; End; end; {change le texte pour les prix, spreads et crée une gauge} procedure TForm1.BIDClientChange(Sender: TObject); begin Label1.Caption := BidClient.Text; DecimalSeparator := '.'; Current := StrToFloatDef(bidClient.Text, 0.0); High := StrToFloatDef(highClient.Text, 0.0); Low := StrToFloatDef(lowclient.Text, 0.0); Ask := StrToFloatDef(askclient.Text, 0.0); Sto := round(((Current-Low)/(High-Low))*100); SpreadTxt:= FloatToStr(Current-Ask*10000); StoTxt := FloatToStr(Sto); With Gauge1 Do Begin MinValue:= 0; MaxValue:= 100; Progress:= Sto; End; end;