Solved

Detecting Parameter in Function-Call ...

Posted on 2000-03-16
11
144 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
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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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 50 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 93
URL for downloading Google Chrome for Win XP 2 157
CheckListBox usage 3 59
Dev express lookupcombo 3 28
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 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