-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
Delphi To/From
To/FromCODEGuides
Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi News / Other Topic   Print This     

"StrToDouble" - someone please?

"StrToDouble" - someone please? in Delphi News / Other topic (part of our Pascal and Delphi Coding group).

Quick Search: "StrToDouble"   someone   "StrToDouble" someone   "StrToDouble" someone please  
Patrik
-- USA
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
Romberg1Integrand := x*x;
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 24 years ago (Thread Starter)
Comment Quote
About Patrik
Visit Profile
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #5588, 2 replies
Thread Started 3/20/2002 11:27:00 PM
View Counter=9541
Last Reply Posted 6/23/2002 11:42:00 PM)
Location=-- USA 
Joined=24 years ago   MB Posts=1  
Most Recent Post
NevilleRichards
 (Inactive)
UK
Assuming you have a finite (and reasonable) number of functions you want to implement, then one trick is to set-up a 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.

Alternatively, simply use a series of if/then statements to compute the appropriate value, given the function required.

Neville Big Grin!
 Posted 24 years ago
Comment Quote
About NevilleRichards
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #5686 (Level 1.1)  Reply to 5588
Thread Started 4/2/2002 5:52:00 AM
View Counter=2
Location=UK  
Joined=25 years ago   MB Posts=41  
Angel
 (Inactive)
England
I dont think I really understand what your driving at! Are you saying that in the combobox the user can select RombergIntegrand1 and then the program calls that function, or does the user select X*X?
 Posted 24 years ago
Comment Quote
About Angel
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #5590 (Level 1.2)  Reply to 5588
Reply Posted 3/21/2002 2:43:00 AM
Location=England  
Joined=25 years ago   MB Posts=199  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1224A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #5588 Counter
9541
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


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