Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

unable to use variable for application.title in dpr?

Posted on 2006-07-06
2
Medium Priority
?
401 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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