IT SOLUTIONS
Your full service technology partner! 
Patrik [Unspecified] -Collapse +Expand
-Collapse +Expand
Patrik
-Collapse +Expand Profile
Member Info
Member Narration

POSTS:
MB Posts (1)◄╣

Search Patrik:

Advanced
   ► MB Lobby   Print This     

Patrik Message Board Activity

  


1 Message Board Posts:


Thread 1 of 1
Thread Starter or a Reply (but not last)  Group

Patrik
"StrToDouble" - someone please?
OK, here's my problem:, , I have this function, function TForm1.Romberg1Integrand(x: Double): Double;, , In Delphisourcecode this function shall looks this:, , function TForm1.Romberg1Integrand(x: Double): Double;, begin, [b]Romberg1Integrand := x*x;[/b], end;, , My problem is, that I want to define the Romber1Integrand in runtime: The user may select a function (in this case it is "x*x") from a ComboBox and the string shall be used as the function. Any idea on how to do this, it's really important!, , Any help is apreciated, thanks in advance.
Posted to MB Topic: Delphi News / Other « Delphi Board
19 years ago

AlanGLloyd
"separate pascal function for each one, and then use type fType = function(d:double):double to form an array of pointers to them so that you can index them from the selected variable of the combo box.", , Most conveniently using the Items.Objects of the TComboBox to store the pointers to the individual functions ..., , CB1.Items.AddObject('x * x', TObject(@XSq));, , Result := fType(CB1.Items.Objects[CB1.ItemIndex])(X);
19 years ago
Nothing New Since Your Last Visit
9001
Hits

Pascal and Delphi Coding
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]