?
Solved

unable to use variable for application.title in dpr?

Posted on 2006-07-06
2
Medium Priority
?
396 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
[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
2 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 200 total points
ID: 17050385
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
ID: 17154236
Ah ok thanks for that Russell, interesting to find out.
0

Featured Post

Independent Software Vendors: 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month8 days, 22 hours 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