I have a weird situation here. The ParentFont property of newly-added components keeps changing to FALSE, within the IDE.
I can demonstrate it as follows:
File|New VCL Forms Application. No need to save anything.
Add 3 tLabels to the new empty form.
In turn, look at each one in the Object Inspector. The ParentFont is set to FALSE - it should be true.
Change each of the labels to ParentFont = TRUE.
Change the font size of the form, several times, and confirm that the labels change as expected.
Select one label, check its ParentFont in the Object Inspector. It's FALSE again!
Change the font size of the form again, and note that the last-inspected label doesn't change.
To me this is consistent with the label's font somehow being changed upon being selected in the IDE, however I can not detect this.
Does anyone have an idea what might be broken? And/or what I can do about it?
=========== [EDIT] ==============
Well, I have uninstalled and done a clean install of Delphi, with no 3rd party components. The problem is still evident!
Here's a video to demonstrate:
http://topshare.com.au/DelphiParentfontProblemDemo.avi
Turns out it's a known problem with XE5:
https://forums.embarcadero.com/thread.jspa?messageID=716297#716297
Related
I am learning Delphi and building a simple NotePad. However, as soon as I add an Action to some ToolButtons (note the align left, center, and right buttons and Bold), they are disabled in the running app, although the Enabled property is set to true in the Object Inspector. They become enabled in the running app if I remove the Action from them in the Object Inspector, but then they are just useless clickable buttons. I have added some pictures below.
I have Googled and tried myself almost to insanity and I really can't figure it out myself.
A normal TAction needs an OnExecute event to become enabled. You can control this with the property DisableIfNoHandler, which defaults to True.
If I set mycoolbar.fixedorder to true,only the grip on the first band will be hidden.
Well,If you use Delphi 7 to create an VCL Forms application,then put a coolbar on it and create 3 coolbans to hold other controls,only the grip and the top coolbands can be hidden by setting mycoolbar.fixedorder:=true.
I've uploaded a picture to make things clear.
You probably got a FixedOrder property wrong. The fixed property does not allow bands to be rearranged if set to True.
Setting up property of CoolBar to True keep user from changing the bands order at runtime, but the user can still move and resize the bands. I can actually give you advice what you can do, but the actual solution for your problem, well, you will have to wait for another answer.
My advice is to use three CoolBars in a row and setting their "FixedOrder" property to True and BandBorderStyle to bsNone. That way the grip will be hidden on all of them.
About the property, it's not a bug of IDE, it is the actual preference of the property.
I noticed that the resize flicker gets much better when I set TPanel.FullRepaint to False. Since the property exists and is True by default, there must be some reason for that.
How to decide whether it should be set or not?
The help just states:
FullRepaint controls how the panel responds when it is resized. When FullRepaint is true, the entire panel, including the beveled border repaints when the size changes. When FullRepaint is false, only the area inside the beveled border repaints.
http://docwiki.embarcadero.com/Libraries/XE3/en/Vcl.ExtCtrls.TPanel.FullRepaint
That text says what it does, but not why ...
The effect of a missing Fullrepaint can be shown and you will have to decide if you need it or not.
Place a panel on a form, set anchors to all directions
Set PaintCaption to false or use a empty caption
Place another panel on the form, so that if you are resizing the
form, parts of the first panel will be covered by the second panel.
Run the program and size the form, somtimes the borders of the first panel will not be refreshed.
This happens because in WMWindowPosChanged in case of (FullRepaint or (ShowCaption and (Caption <> ''))) a invalidate will be called, otherwise only InvalidateRect(Handle, Rect, True) of a rects only containing the right and/or bottom border are invalidated. (thanks to Sertac Akyuz for correction)
As you mentioned avoiding invalidate reduces flicker and in many cases the need for a full invalidate is not given, so the user can decide on his own how to proceed.
Panels as the rarely will be used, upper without Fullrepaint
In previous versions of Windows (not sure up to which version, exactly) FullRepaint was required to prevent graphical artefacting on panel borders when a form was resized.
To the best of my knowledge, this hasn't been an issue since at least Windows XP.
I can't seem to figure out how to change the font of a tmenuitem object.
I add a menubar, and add a item to it.
I create a customstyle for the menuitem.
I can change the background color and stroke color etc,etc, but I can NOT change the font of the text part.
If I change the font (size or name or anything) it shows in the style editor but does not show in the form designer or at runtime.
Seems the font somehow default to something.
Has anyone else been able to do this ?
FireMonkey overwrites pretty much any settings you make for fonts (face, size, style) within a style. AFAIK any font changes you want to make have to be done at run time. In the case of a TMenuItem that means by setting the Font property manually after you have created the menu item.
However (and I've never played with this) I seen people saying they can change a font by setting the StyleLookup after a component has been created.
You might want to hook into the OnApplyStyleLookup event to make these updates.
When creating TDBGrid components dynamically at runtime, i can't forbid user to edit values in cells. This is how I am trying to accomplish this type of behaviour:
TDBGrid *DbGrid = new TDBGrid(Owner);
DbGrid->Options = DbGrid->Options >> dgEditing;
When disabling dgEditing in form designer all is functioning correctly. I can't find the difference between these two cases. What should I do to disable edit of DBGrid cells?
The trick is to do this in following way:
DbGrid->Options = TDBGridOptions(DbGrid->Options) >> dgEditing
but I do not know what is the difference.
I have the same problem with the Seattle version of C++Builder in that I am unable to programmatically change whether the DbGrid allows or disallows editing. The DbGrid->Options values CAN be changed without requiring the TDBGridOptions() cast but the DbGrid does not follow what the DbGrid->Options are set to. If they are set in the object inspector for dgEditing enabled, then the DbGrid always allows editing no matter what the state of DbGrid->Options.dgEditing is and if in the object inspector dgEditing is disabled then the DbGrid never allows editing. It at first APPEARS to work (i.e. the highliting of rows vs cells changes). I have tested this using both DbGrid->Options.ToInt() and DbGrid->Options.Contains(dgEditing) to ensure I'm not stumbling over myself.
I finally found a way to make it work.
If you set the dgEditing to true (for the Options of the DBGrid in the Object Inspector), this will let the user edit at any time. Then, set DBGrid->ReadOnly=false when the user should not be allowed to edit.
I did not have any luck trying to set the individual DBGrid->Columns->Items[ii]->ReadOnly=false. The program did not prevent me from doing that, but it did ignore whatever I had in it.
I wrote a special small test program with minimum components and was able to get good results just by setting the dgEditing to true in the object inspector and then changed dgEditing to false when I wanted to prevent the user from editing, but when I put it into my full program, something prevented the DBGrid from working.
The DBGrid->ReadOnly may be a work-around for someone else also.