Solved

unable to use variable for application.title in dpr?

Posted on 2006-07-06
2
393 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 50 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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