Solved

Lookup Table ?

Posted on 2012-03-21
1
446 Views
Last Modified: 2016-09-29
i have a class that holds some methods...

Server sends Client a function name and Client uses a statement (case/of) to execute it from a hardcoded indexed TStringList.

how can i avoid this ?

someone told me something like this...:

you could use an enumerated type shared across both projects. on the startup of the server, it would index the functions (as procedure objects) in a list, based on the enumerated type

when calling your server's function, just cast the enumerated type as an ordinal, which would change it to integer so it can be transported over socke

that is how to pass a procedure as a pointer
[20/03/2012 23:47:02] Jeff Lefebvre: store a list of procedure pointers, indexed by an enumerated type

1) the link i sent you talks about procedure pointers
2) add procedure pointers into a TList or array, in the same order as the list enumerated type elemented
3) you could do it in a TList, or array of pointers
4) yes, or a TList
0
Comment
Question by:rotem156
1 Comment
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 37753773
@rotem156

>>can i see a sample code

This is new code?  Your question stated that you already have a class with public functions/methods.

There are some code snippets in the comments to a similar question
http://stackoverflow.com/questions/4186458/delphi-call-a-function-whose-name-is-stored-in-a-string
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now