?
Solved

Lookup Table ?

Posted on 2012-03-21
1
Medium Priority
?
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month9 days, left to enroll

764 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