Changing a Label's Font Style at run time [Edit]

IW14.0.22Ultimate. DelphiXE4.

TIWLabel.OnMouseOver I'd like change the Font.Style to fsunderline. It appears compiler does not like any changes to font style beyond those established at design time.

Is there a unit that I'm not including, or if not, does anyone know of any run-time work-arounds short of writing a css or adding the styles to an existing one?

Thinking I might outsmart any style sheet or css I set the style as underline at design-time (component and region) so I could clear the style at MouseOver (which works) and then get it back on OnMouseOut, but it didn't work. Same goes for fsBold. 

TIA - Kevin

Edited by: Kevin Kelly on Dec 29, 2013 4:29 PM
0
Kevin
12/30/2013 12:34:49 AM
embarcadero.delphi.intraweb 3901 articles. 1 followers. Follow

7 Replies
2109 Views

Similar Articles

[PageSpeed] 39

How are you trying to change it?  I am using IW12 and the code below works.

{code}
procedure TIWForm1.IWLabel1AsyncMouseOver(Sender: TObject; EventParams: TStringList);
begin
  IWLabel1.Font.Style := [fsUnderline];
end;

procedure TIWForm1.IWLabel1AsyncMouseOut(Sender: TObject; EventParams: TStringList);
begin
  IWLabel1.Font.Style := [];
end;
{code}

You could add another line, such as "IWLabe1.Invalidate;" within each function to force the label to be redrawn.
0
Daniel
12/30/2013 12:35:43 AM
Hi Dan - That's exactly the code I'm using in IW14 + XE4.

When trying to run the project the style fsUnderline or any style short of [] is reported as unknown and an error.

Using Invalidate on MouseOut did not cause the label to be re-rendered to it's original state.

Beats me - Kev


> {quote:title=Daniel Fields wrote:}{quote}
> How are you trying to change it?  I am using IW12 and the code below works.
> 
> {code}
> procedure TIWForm1.IWLabel1AsyncMouseOver(Sender: TObject; EventParams: TStringList);
> begin
>   IWLabel1.Font.Style := [fsUnderline];
> end;
> 
> procedure TIWForm1.IWLabel1AsyncMouseOut(Sender: TObject; EventParams: TStringList);
> begin
>   IWLabel1.Font.Style := [];
> end;
> {code}
> 
> You could add another line, such as "IWLabe1.Invalidate;" within each function to force the label to be redrawn.
0
Kevin
12/30/2013 12:52:43 AM
At least you know you're not crazy.

If you have CGDevTools, you can place it on one of their regions and make a procedure call.

Edited by: Daniel Fields on Dec 29, 2013 5:01 PM
0
Daniel
12/30/2013 1:02:26 AM
> At least you know you're not crazy.
> 
> If you have CGDevTools, you can place it on one of their regions and make a procedure call.


Hahaha. Yeah - I needed that Dan. Thanks.

Yes I do use CG, but they inherit much from IW and I've been using IW components for years. BTW - their's have the same issue (parent problem?). And - it used to work for me too in XE2+IW12. Lesson: Don't ever think that upgrading packages is painless :-)

That's why I'm asking the question on this forum.

Like my grandpa used to tell me: "Being Irish does not mean your are automatically stupid".

Cheers - Kevin
0
Kevin
12/30/2013 2:04:02 AM
So what say you AtoZed?

IW12-to-14 bug or depreciation?

XE2 to XE4 issue?

Work-around or not?

Thanks and Happy New Year - Kevin
0
Kevin
12/31/2013 12:11:51 AM
> {quote:title=Kevin Kelly wrote:}{quote}
> IW14.0.22Ultimate. DelphiXE4.
> 
> TIWLabel.OnMouseOver I'd like change the Font.Style to fsunderline. It appears compiler does not like any changes to font style beyond those established at design time.

If you have a compiler error, then you are probably not including Graphics.pas in your uses clause? This was tested with latest IW 14 and works as expected:

{code}

implementation

{$R *.dfm}

uses
  Graphics;

procedure TIWForm1.IWLabel1AsyncMouseOver(Sender: TObject;
  EventParams: TStringList);
begin
  IWLabel1.Font.Style := [fsUnderline];
end;

{code}
1
Alexandre
1/6/2014 1:45:24 PM
> 
> uses
>   Graphics;
> 

That was the problem Alexandre. Apparently a change between XE2 and XE4 or IW12 and IW14 that I missed.

Thanks for your help and all the best - Kevin
0
Kevin
1/6/2014 4:56:43 PM
Reply:

Similar Artilces:

Change a column's edit style at run-time
How do you change a column's edit style at run time? We need to toggle a column between edit and drop-down datawindow. We've succeeded in changing it from edit to dddw by setting dddw properties via Modify. Setting edit properties doesn't change it back, however. The Edit.Style property is only valid for Describe. Any ideas? Put the column twice in the detail band, overlay, set .visible property and toggle it. Simple and effective.. Stephanie Giovannini wrote in message <5VxwtLVU#GA.226@forums.powersoft.com>... >How do you change a column's edit styl...

Third party Delphi component change IDE's font to 'system' typeface [Edit]
Hi I tried to use a third party component http://code.google.com/p/delph-sciter/ after I registered the component and tried to put it onto a form. most part of delphi IDE's font changed to 'system' typeface. I searched over web. looks like some person has the same issue before: http://groups.google.com/group/borland.public.delphi.ide/browse_thread/thread/71849ab73ec37ed2/e4c0cbac0487e919?hl=en&q=delphi+IDE+font&pli=1 Could anyone help this issue? Edited by: John Liuo on Apr 30, 2010 5:45 PM John Liuo wrote: > Hi > I tried to use a third party compo...

It's possible to change WebDataWindow's syntax at running time ?
It's possible to change a Web DataWindow's syntax at running time ? Thanks for any suggestion. David W If you access the web dw through 4GL Web Page, then you can change the Web DW SQL Syntax at run time by calling dw_1.SetSQLSelect(sqlquery) or dw_1.Modify(syntax) function through any one of the 4GL Web Server-side events. Azeez On Sun, 28 Jul 2002 15:29:39 +0800, in powersoft.public.powerbuilder.web-targets David W <milon@nbip.net> wrote: >It's possible to change a Web DataWindow's syntax at running time ? > >Thanks for any suggestion...

How to change a column's Style at run time
I have a datawindown with a couple of columns on it. I would like to display column A in a different Style under different situations. e.g. display column A in "DropDownDW" style when a user click on "Browse" button and display it in "Edit" style when a user click on "Insert" button. I really appreciate if you can show me how. ...

How to change a column's Style at run time for datawindown
I have a datawindown with a couple columns on it. I would like to display column A in a different Style under different situations at running time. e.g. I would like column A to display DropDownDW Style when user click on the "Browse" button and display Edit Style when user click on the "Insert" button. I really appreciated if you can show me how. Hope wrote: > > I have a datawindown with a couple columns on it. > I would like to display column A in a different Style > under different situations at running time. > e.g. I would like column A to...

How to change a column's Style at run time #2
I have a datawindown with a couple of columns on it. I would like to display column A in a different Style under different situations. e.g. display column A in "DropDownDW" style when a user click on "Browse" button and display it in "Edit" style when a user click on "Insert" button. I really appreciate if you can show me how. Check out the Modify command, eg dw_1.Modify("<colname>.dddw...") and dw_1.Modify("<colname>.edit...") Setting a dddw property will automatically change the edit style to dddw, simila...

How to change a column's Style at run time for datawindown
I have a datawindown with a couple columns on it. I would like to display column A in a different Style under different situations at running time. e.g. I would like column A to display DropDownDW Style when user click on the "Browse" button and display Edit Style when user click on the "Insert" button. I really appreciated if you can show me how. Hope wrote: > > I have a datawindown with a couple columns on it. > I would like to display column A in a different Style > under different situations at running time. > e.g. I would like column A to...

Module c:\Delphi\MyProgram.exe's Time/Date Changed. Reload Message appears [Edit]
Using D2010, XP Pro. Module c:\Delphi\MyProgram.exe's Time/Date Changed. Reload Message appears on every compile. Files are stored on the local c: drive. One clue is that this seems to have happened since we had a change from Summertime Daylight Saving Time (+1Hr) back to normal EST. I have no idea why this has suddenly appeared as I haven't made any changes to the IDE or done anything out of the ordinary. Edited by: Jeffrey Ottery on Apr 25, 2013 10:15 PM Edited by: Jeffrey Ottery on Apr 25, 2013 11:08 PM ...

it's running on design time but not run time.
Code is like that. This code is running on desing time.. but it is not running on run time. Exception is "ComException:An operations error occured." After "search.findOne(); " exception occured. Probably reason is security.. but What's wrong? Thanks for advice. Code lines: --------------------------------------------------------------------------------------------------------------System.Security.Principal.WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentity)Page.User.Identity).Impersonate(); Session["UserName...

Why does Delphi change Indy's dpk source file when I change project options [Edit]
Good day I have noticed that Delphi changes dpk source files for packages after I have changed something in that package's Project Options and in Indy's case it does it incorrectly. Why is that. For example... I open IndySystem170.dpk (Indy 10.6.0.5155) inside Delphi XE3 and get the following DPK source: {code} package IndySystem170; {$R *.res} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} {$DEBUGINFO ON} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} {$LOCALSYMBOLS ON} {$LONGSTRINGS ON} {...

Change column of Style 'Edit' Into 'DDLB'
Hi All I'm using PB703 Build 10213 I'd Like to know if there is any way to change the Style of a column on runtime From Style 'edit' to Style 'ddlb'. I've tried dw_xyz.Modify("column1.Edit.Style = 'ddlb'") but I get an error "Syntax Error at column xyz". Whats wrong with this? On the other hand: dw_xyz.Describe("column1.Edit.Style") returns 'edit'. Note that: If you have a column of style 'ddlb' and you try this dw_xyz.Modify("clo_ddlb.DisplayOnly = Yes") the column...

Module s:\Delphi\MyProgram.exe's Time/Date Changed. Reload Message appears
Using D2010, XP Pro. Module s:\Delphi\MyProgram.exe's Time/Date Changed. Reload Message appears on every compile. I have no idea why this has suddenly appeared as I haven't made any changes to the IDE or done anything out of the ordinary. Jeffrey Ottery wrote: > Using D2010, XP Pro. > > Module s:\Delphi\MyProgram.exe's Time/Date Changed. Reload Message appears on every compile. > > I have no idea why this has suddenly appeared as I haven't made any changes to the IDE or done anything out of the ordinary. It just started on my D7 install too. S...

Change edit style at run time
Hi, Is it possible to change the edit systle of a column at run time based on a condition, like edit to editmask at runtime? Thanks You could place two copies of the column on the datawindow in the same exact place, one as editmask and one as edit. Then put an expression on the visible property of both of them such that only one is visible at a time. A good way to do this is to have a hard coded value in your SQL statement then use SetItem in a script to change the value. The visible expressions would key off the value of this column. <Satish> wrote in message news...

How to change tree view's (web control) back color, font color and font size using CSS (Cascading Style Shteets)
Hi All, I have created tree view (web control) but i want to change all the properties of it, through single style sheet. Like all other controls (label, text box and combo box) it's not possible to change all the properties of treeview through single style sheet by including it to the contol ???? Please help........ MAITRAY. Sorry. No external css. but these attributes: DefaultStyle="background:#CCCCCC;border:solid 1px;color:black;font-size:8pt" HoverStyle="color:blue;font-name:Arial" SelectedStyle="c...

Web resources about - Changing a Label's Font Style at run time [Edit] - embarcadero.delphi.intraweb

Resources last updated: 1/16/2016 3:22:42 PM