Solved

unable to use variable for application.title in dpr?

Posted on 2006-07-06
2
384 Views
Last Modified: 2010-04-05
Title says it all, but can someone explain why I can't seem to associate a string variable at runtime in the dpr to the application.title?
Everytime I put the line of code in, it disables the RUN application button, and then if I save and leave it in and try and reopen the application, it is now corrupt and I have to restart from a prvious version of the code.

I'm guessing this is just something I didn't know you couldn't do but I'm just checking.

var
  sTemp: String;
begin
  .
  .
  .
  Application.Title := 'This string'+ sTemp;
0
Comment
Question by:mikelittlewood
2 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 50 total points
Comment Utility
Its a "known" feature (at least to borland)/

// This is a known 'feature' and it has been there since Delphi 1. Notice I
// don't call it a bug. The reason this works like this is because we allow you
// to set the Application.Title in the IDE so we need to set it to a string.
// With a const we wouldn't know what type it was unless we did a full
// expression parse on it. It isn't worth it.
//
// -- Robert Kozak (Borland)


The workaround is to perform something similar to the following:


var
  sTemp:         String;

procedure SetTitle(App: TApplication);
begin

  App.Title:='This string'+ sTemp;

end;

begin

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  SetTitle(Application);
  Application.Run;

end.


Regards,
Russell
0
 
LVL 15

Author Comment

by:mikelittlewood
Comment Utility
Ah ok thanks for that Russell, interesting to find out.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

13 Experts available now in Live!

Get 1:1 Help Now