mahdisafsafi / zcontrols Goto Github PK
View Code? Open in Web Editor NEWzControls
zControls
I am reopening issue #25 because I found a couple of issues with the solution I suggested there and was implemented.
Suggested changes:
a) Replace BooleanToStr with the following:
function BooleanToStr(B: Boolean): string;
begin
if B then
Result := STrueValue
else
Result := SFalseValue;
end;
The reason is that the use of the resource strings in the constant does not work because presumably the compiler initializes the constant when the program is loaded and the translated strings are not picked up.
b) Currently BooleanToStr is only used in set properties and not in Boolean properties. Modify the TzCustomValueManager.GetValueName as follows.
if PItem.IsSetElement then
begin
Result := BooleanToStr(SetEnumToBoolean(GetEnumOrdValue(Value), PItem.SetElementValue));
Exit;
end
else if (Value.TypeInfo = TypeInfo(Boolean)) then // added this if block
begin
Result := BooleanToStr(GetValueAs<Boolean>(Value));
Exit;
end
I had a play with your great component and was glad to see that you use the new RTTI features, which makes it possible to expose a lot more than just published properties. I did a little test and with only a minor tweak in the sources the control could also show private, protected and public fields and properties. Maybe you should consider making this an optional feature.
As of now I am not aware of any commercial or open source object inspector control that is able to do that.
Not everyone installed Delphi to the default path. Which leads to ...
In InspDemo.vrc
AmethystKamri VCLSTYLE "e:\coding\XE8\Redist\styles\vcl\Studio\15.0\Styles\AmethystKamri.vsf"
CyanDusk VCLSTYLE "e:\coding\XE8\Redist\styles\vcl\Studio\15.0\Styles\CyanDusk.vsf"
Luna VCLSTYLE "e:\coding\XE8\Redist\styles\vcl\Studio\15.0\Styles\Luna.vsf"
[BRCC32 Error] InspDemo.vrc(66): file not found: C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\AmethystKamri.vsf
[BRCC32 Error] InspDemo.vrc(67): file not found: C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\CyanDusk.vsf
[BRCC32 Error] InspDemo.vrc(68): file not found: C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\Luna.vsf
Delphi 11 changed the default font to Segoe UI 9 pts. The default FItemHeight of 17 is too small for that font. The problem is much worse with High DPI applications. See image below:
The problem is that when using the default font (ParentFont is True) TzScrollObjInspectorList.CMFONTCHANGED, which correctly sets FItemHeight is not called.
Solution:
Add another method TzScrollObjInspectorList.CMPARENTFONTCHANGED with the following code:
procedure TzScrollObjInspectorList.CMPARENTFONTCHANGED(
var Message: TCMParentFontChanged);
begin
inherited;
if ParentFont then
begin
Canvas.Font.Assign(Font);
FItemHeight := Canvas.TextHeight('WA') + 4;
end;
end;
This method is always called and the problem is solved. And while fixing this you may want to expose the ParentFont property.
I am seeing an exception when deleting a TzObjectInspector from a form at design time.
Solution
Change TzScrollObjInspectorList.UpdateScrollBar to:
procedure TzScrollObjInspectorList.UpdateScrollBar;
begin
if Assigned(Parent) and not(csDestroying in ComponentState) then
begin
FSI.cbSize := SizeOf(FSI);
FSI.fMask := SIF_RANGE or SIF_PAGE;
FSI.nMin := 0;
FSI.nMax := VisiblePropCount - 1;
FSI.nPage := GetMaxItemCount;
SetScrollInfo(Handle, SB_VERT, FSI, False);
InvalidateNC;
end;
end;
Hello,
I want to write my own Object Inspector. My code was available to Lazarus. Can I model your code? I mainly mean the way of grouping properties of objects into categories.
Regards
When I try to open the links I get the following error:
Invalid upstream response (429)
Is it possible to fix the drawing of the border when styles are enabled? The border is not rendered now. You can see that there is a non-client area when the border style is bsSingle. But there is no border. Thanks!
It would be nice to allow localization of the the lables "True" and "False"
All you need is to replace:
function BooleanToStr(B: Boolean): string;
const
BoolStrs: array [Boolean] of String = ('False', 'True');
begin
Result := BoolStrs[B];
end;
with
resourcestring
rsFalseLabel = 'False';
rsTrueLabel = 'True';
function BooleanToStr(B: Boolean): string;
const
BoolStrs: array [Boolean] of String = (rsFalseLabel, rsTrueLabel);
begin
Result := BoolStrs[B];
end;
A dedicated dropdown combobox for keyboard shortcut properties (TShortCut) is missing.
Problem with component installation in Delphi 2007: when trying to open zControls.groupproj message: "project XXX could not be loaded. Only one top-level element is allowed in an XML document."
Hi,
I'm trying to inspect TFDMemtable FieldDefs, IndexDefs... properties.
How can we display those list at runtime ?
Thank you
In the sources I forked I added basic support for mouse wheel scrolling events:
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
As per title.
Also in the code there is a DialogCode procedure that gets called but does nothing.
This is not a issue, it is a question.
Will there be any way to use the TzObjectInspector component to modify the configuration options of my program?
I do not want to modify the properties of the objects, but I can add configuration options and modify them. As delphi does. If not, this could be another good component that you could add to zControls.
Greetings.
Sorry my bad english.
Easy to reproduce.
Edit a string property say by typing a few characters and without pressing Enter, press up/down key.
procedure. The problem is in the method below.
TzCustomObjInspector.UpdateEditControl(const SetValue: Boolean);
var
PItem: PPropItem;
BtnWidth: Integer;
LTxtValRect: TRect;
begin
if Assigned(FPropInspEdit) then
if Assigned(FPropInspEdit.Parent) then
begin
FPropInspEdit.PropInfo := nil;
FPropInspEdit.Visible := False;
end;
It first sets PropInfo to nil and then Visible to false. The second statement results in a KILLFOCUS message which calls DoSetValueFromEdit with FPropInfo equal to nil.
** Solution: **
Reverse the statements, so that first the value gets updated and then PropInfo is set to nil.
i.e.
if Assigned(FPropInspEdit) then
if Assigned(FPropInspEdit.Parent) then
begin
FPropInspEdit.Visible := False;
FPropInspEdit.PropInfo := nil;
end;
Check boxes in values are not painted DPI-scaled if you use Delphi 10.4 DPI-Aware styles.
See #33
If you compile and run the supplied demo, then switch any other programs else, for example, your text editor or the Delphi IDE, you press TAB and it no longer works. you quit the demo program and the issue goes away.
I have the same issue in the program that uses TZObjectInspector.
That's a wired issue, but the inspector control is great!
I know it is now possible by assigning the global DefaultValueManager
variable to your own overridden class of TzCustomValueManager
.
It would be cleaner to add a public TzCustomValueManagerClass
property to TzObjInspectorBase
(or even better: an interface type that is implemented by TzCustomValueManager
).
Another way to provide your own property value editors could be through an extra event property in which you can provide your own class or instance of the value editor:
OnGetEditorClass(
Sender : TObject;
AInstance : TObject;
APropInfo : PPropInfo;
var AEditorClass : TzPropertyEditorClass
);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.