Solved

Detecting Parameter in Function-Call ...

Posted on 2000-03-16
11
143 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

24 Experts available now in Live!

Get 1:1 Help Now