TListView truncate hints when using styles - delphi

I have a problem with TListView when using Application styles.
Sometimes the hints are truncated. It depends on spaces and length of words in the string.
For example:
'1518 ZL Danovy doklad odeslany' is truncated
'1518ZLDaňový doklad odeslaný' ' is OK
This is happening in Delphi 10.2.1! In Delphi XE7, it was all OK! So I think it must be some kind of bug in this version.
Is there any way of fixing it, or a workaround?
ScreenShot of problem:
Simple project:
https://www.dropbox.com/s/q30i9vlejt1vst7/ListViewTest.7z?dl=0
Things I tried:
removing the LVS_EX_INFOTIP flag (with ViewStyle.vsIcon not working):
ListView_SetExtendedListViewStyle(
ListView1.Handle,
ListView_GetExtendedListViewStyle(LV.Handle) and not LVS_EX_INFOTIP
);
Removing the style from TListView as here:
How to disable VCL styles in Delphi

Related

Delphi 7 cyrillic characters not showing correctly

i recently asked (and paid) for translation of my Delphi app to support Macedonian (Cyrillic font) support.
I posted text to translate to my contracted translator, she sent me back translated strings. The text was extracted from all my .dfm and .pas files
when i replaced the original text with cyrillic translation, i can open .dfm fies also .pas files in my favourite Notepad++ (or notepad) , and i see translated characters correctly.
When i open these files in Delphi (as dpr file) , i see something like this:
Please someone tell me how to convert/display these strings in Delphi correctly.
I am using Macedonian regional settings, but it not helped me with this problem.
PS: Yes I am still using Delphi 7 because i love it / purchased this version.
UPDATE
Original text in Delphi:
original: ПОДГОТВИ КУТИИ ЗРДРУГИТЕ ЦЕÐТРÐЛИ
Correct text:
ПОДГОТВИ КУТИИ ЗА ДРУГИТЕ ЦЕНТРАЛИ
I noticed, when i change ParentFont property to false and font set to Verdana and Cyrillic (RUSSIAN_CHARSET) , then i copy/paste cyrillic text, it shows normally in Delphi
OK so i SOLVED that!
The solution is multi step one, and Notepad++ is needed:
1st step: Replace all fonts in .dfm with (for example) Verdana , or some font that allows Cyrillic support
2nd step: Replace all ParentFont = False to ParentFont = True
3rd step: In notepad++ Choose: Encoding -> Convert to ANSI
that's all, do this for all .dfm and .pas file (only 3rd step)
i am happy to not Listened David Heffernan and not gave up!
Your text file was UTF-8 encoded, whereas Delphi7 requires WinAnsi encoding, with codepage 1251 for Cyrillic characters.
You have the UTF8Decode() function in System.pas to make the conversion programmatically, if you prefer.

Why is the ampersand missing in Firemonkey combo?

When you create a Delphi project and add a combobox and set ComboBox1.Items.Add('Zebra & Zulu') it shows "Zebra & Zulu" when you dropdown the list. Perfect.
When you create a Firemonkey project and add a comboxbox or comboedit and set ComboBox1.Items.Add('Zebra & Zulu') or ComboEdit1.Items.Add('Zebra & Zulu') it shows "Zebra Zulu" (no ampersand shows) when you dropdown the list. However, when you select it using the comboedit the text field part shows "Zebra & Zulu". Just weird.
Now there is a work around (sort of) but to me it is questionable. Add a second ampersand and the dropdown list shows the ampersand. However, adding the second ampersand shows up on the comboedit text field part. Bad.
My question is can you force these combo controls dropdown list to show the ampersand? And why is the ampersand missing in the first place?
This seems to be inbuilt behaviour that is likely leftover from the VCL's accelerator key handling. There does not seem to be a way to modify this behaviour with styles or options :
procedure TTextControl.DoChanged;
var
TextStr: string;
begin
if Assigned(FITextSettings) then
FITextSettings.TextSettings.BeginUpdate;
try
if Assigned(FITextSettings) then
FITextSettings.TextSettings.Assign(ResultingTextSettings);
TextStr := DelAmp(Text); // **! Here deleting ampersands unconditionally
if Assigned(FTextObject) then
begin
UpdateTextObject(FTextObject, TextStr);
// ... etc - method continues
One workaround is to use the unicode full-width ampersand :
ComboBox1.Items.Add('Zebra & Zulu');
Obviously not appealing for a number of reasons.
From the code above, this naturally affects all FMX TTextControls - even a TLabel, for example, will not display an ampersand when assigned :
Label1.Text := 'Zebra & Zulu';
Even in a VCL application, for interest, this:
Label1.Caption := 'Zebra & Zulu';
will render as
Zebra _Zulu
Although a VCL TComboBox will correctly render an item with a single ampersand...
This is an open QC, albeit one that does not appear in any hurry of being addressed :
http://qc.embarcadero.com/wc/qcmain.aspx?d=122564

Change progressbar color

I have a progressbar in my form and I need to change its color. I need it to be Yellow and so I am using this code:
SendMessage(ProgressBar5.Handle, PBM_SETBARCOLOR, 0, clYellow);
I am using Lazarus and I couldn't use the SendMessage(); procedure. Then I have googled a bit and I found that I need to include in the uses the lclintf library.
Now I have another hassle because Lazarus can't recognize the parameter PBM_SETBARCOLOR. In fact it states:
unit5.pas(245,50) Error: Identifier not found "PBM_SETBARCOLOR";
I see that the first line of code that I wrote is the only way to change the color of a ProgressBar from green to the one I need.
Any help? I am using the latest version of Lazarus.
The PBM_SETBARCOLOR is declared in the commctrl.pp unit of freepascal, same as in Delphi.
You could also declare it as a constant with value 1033 (WM_USER + 9).

How to change the font of the page numbers in word using delphi xe5

I am automating word documents. Generating them solely from code.
Currently i am adding a page number in the header of each page, But i would like to know how to change the font name of the page number along with the font size.
Any help would be appreciated.
Please note, wrddoc is the active document variable.
here is the code i create the page number with:
wrdDoc.Sections[1].Headers[1].PageNumbers.Add(wdAlignPageNumberRight);
And i tried the following code to change the font but i get an error, "method font is not a supported automation object":
wrdDoc.Sections[1].Headers[1].PageNumbers.Font.name:='Times New Roman';
wrdDoc.Sections[1].Headers[1].PageNumbers.Font.Size:=12;
Any help would be appreciated thank you.
It works for me:
wrdDoc.Sections.First.Headers.Item(1).Range.Font.Name := 'Times New Roman';
wrdDoc.Sections.First.Headers.Item(1).Range.Font.Size:= 12;
Delphi XE, Office 2010.

Delphi: EReadError with message 'Property Persistence does Not Exist'

My program written with Delphi 7 compiles OK, but when I run it it gives me the error message:
Project1.Exe raised exception class EReadError with Message 'Property Persistence does Not Exist'. Process Stopped.
This only started after I installed the TMS Component Pack to use with this project. Thanks for any help.
Open the Form in Delphi IDE
Use Alt + F12 to edit the .DFM source
Search the "Persistence" property
Delete the line with "Persistence" property
DFM example:
SomeComponent1 = TSomeComponent
OtherProperty = OtherValue
Persistence = True
AnotherProperty = AnotherValue
end
Also you can use the great DFMCheck 1.4 tool, by Andreas Hausladen. To check any other missing property like that:
http://andy.jgknet.de/blog/?page_id=177
This is most likely caused by the compiled & installed package being out of sync with the actual .pas file. If you have source code then rebuilding the packages will probably fix it.
Set a breakpoint(F5) and step the program(F7/F8).Get to the location where you get that exception and then give us more information about it(show some code).
This error means that it's trying to load something (usually a form) from a DFM resource and it comes up with a value for a property that the component it's creating doesn't have.
If it only happened when you started using TMS components, the solution is simple: don't use them. Send as much information as you can about the error and the project that caused it to the authors and see if they can find a way to fix it. Until then, use something else.
If you're using text DFMs (right click on the form, check "Text DFM", save), you can use Search|Find in Files to find all instances of Persistence in your DFM files. Just set the search string to "Persistence" (I usually tell it to ignore case), the file mask to "*.dfm", and check the "All files in project" checkbox.
If you're not already using text DFMs and don't want to manually open all forms and check the box and then resave them, you can use CONVERT.EXE (in the ($DELPHI)\Bin folder) to convert them en-masse. Run CONVERT with no parameters from any command prompt to see the options. By default, CONVERT will save .DFM as .txt, but you can have it work in-place (rewriting the binary .DFM as the text .DFM) by using the -i switch. (I usually back up the .DFMs to a different folder first, then convert them. If no errors are reported, I can then delete the backed up .DFMs later.)
I had similar problem with TMS when I upgraded to a new version:
If you think that some particular component is causing the problem,
delete it , compile project without it, place it on the form/frame again.
If that doesn't work for you:
Things you need to do in order to fix the problem , so you can use Designer and new properties, because that's what you really want , don't you ? :-) :
Uninstall TMS Component Pack ( or whatever you're using )
Re-Install TMS Component Pack
Build & Install the packages
Add appropriate TMS .lib files to your Application Project ( I'm using C++ Builder )
Add appropriate TMS .pas files to your Application Project . For example I had a problem with TAdvSmoothCalendar component , so I've added the AdvSmoothCalender.pas to my project.
Cheers!
I hope it works for everyone with a similar problem :)
I had similar problem with nuiGui Delphi Framework,
To Solve this, create a include file with some properties and use it in your class.
/// include class 'Basic.inc'
private
function GetWidth: Integer;
published
property ClientHeight : Integer Read FHeight Write FHeight;
//property ClientWidth : Integer Read FWidth Write FWidth;
//property OldCreateOrder : Boolean Read FOldCreateOrder Write FOldCreateOrder;
end;
...
/// main class like this
TuMemoFrame = class(TUniFrame)
UniMemo1: TUniMemo;
UniMemo2: TUniMemo;
UniButton1: TUniButton;
procedure UniButton1Click(Sender: TObject);
private
public
{$Include Basic.inc } // <---
end;

Resources