Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detecting Parameter in Function-Call ...

Posted on 2000-03-16
11
Medium Priority
?
151 Views
Last Modified: 2010-04-04
Hi Experts,

I'm writing a function which has to write a given Message to :
  1) a Rx-RichEdit (given parameter)
and/or
  2) a LogFile on disk (given parameter)

Here's my function definition :
Function  WriteMessage(rxreLog: TRxRichEdit ; Msg: String ; strLogFile: String ;
                       colKleur: TColor) : Boolean;


This is what I want to do :
If the user passes NIL for rxreLog, then the message should not be written to the rxRichEdit.

If the user passes '' for strLogFile, then the message should not be written to the logfile on disk.


Now my question :
How can I detect if the rxreLog-parameter is nil ?
The following statement doesn't work :
  if rxreLog = nil then
    DoNothing
  else
    DoWrite


Can someone please help me out with this ?


Thanx in advance.

The Mayor.
0
Comment
Question by:wimmeyvaert
[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
11 Comments
 
LVL 2

Expert Comment

by:craig_capel
ID: 2624524
have you tried... if rxrelog = 0 then
  do nothing?
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2624551
I don't know about rxRichEdit but using standard RichEdit your test will always return FALSE (i.e. rxreLog is NOT nil) unless you specifically set rxreLog to nil (e.g. rxreLog := nil)

You might be better off passing something other than a RichEdit (or variation) OR passing another value holding something like the line count (-1 indicating no lines). No better ideas I'm afraid

The Neil
0
 
LVL 3

Expert Comment

by:markshiffer
ID: 2624615
if rxeLog = nil then
....

rxeLog is just a pointer so you can test directly for nil

what error do you get?
0
Industry Leaders: 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!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 2624785
? what about
if assigned(rxelog) then
  //doall
else
  //donothing
0
 

Expert Comment

by:jhook010598
ID: 2625069
if not assigned(rxelog) then
  //donothing
else
  //dosomething
end
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2625353
Can you show us how you are calling the function?
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 2625531
to jhook,
i don't like negative conditions,
therefore i've changed the order in my comment ;-)
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 2626847
Yo Mayor,

Zeg manneke da mocht ge altijd aan mij persoonlijk vragen ook zunne ;-)

E-mail : Stefaan.Lesage@dexia.be
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2626873
"if Assigned(object) then" is exactly the same as "if object = nil then". Both should work alright. Where is the problem? It works for me!   :-)

Regards, Madshi.
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 2626874
Hi,

I want to thank everybody for the fast replies.

My conclusion is that the comment of Kretzschmar is the best solution for me.
So I grant the points to you ;-)


Greetings,
The Mayor

P.S. : Is there a possibility to split the points and give them to 2 experts?
If so, how can you do this?
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 2628008
Hi Mayor,

Well there isn't exacly a way to split the points.  Normally we simply post a new question for a specific person, so that he/she can get the points too ;-)

Best regards,


Stefaan

a.k.a. Kingetje

P.S. : I'll call you this or next week
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

660 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