Jump to content

Search the Community

Showing results for tags 'delphivcl'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 8 results

  1. So far, when I wanted to add a new UI component to DelphiVCL, I always started from DelphiVCL source, added the new unit with classes and types, and created a “clone” of the package with the new functionality using that instead of DelphiVCL. It works but I would like to “not touch” the original version of DelphiVCL installed by PyPi but only create an extensive module (pyd) with only the new UI controls. At this point I don't know if this can be done. I still understand little about P4D but it seems to me that each new module requires a PyEngine which loads the python DLL and this is already instantiated by DelphiVCL and if I create a new package with my new module and controls I assume there will be conflicts. Is this a viable way ? Is there any way to reuse the egine already created by original DelphiVCL to use it in my custom PYD ? I thank in advance those who will help me to dispel these doubts. Best regards Silverio
  2. I found an oddity in the "state" field of the OnCustomDrawItem event. Basically instead of reporting the states of the VCL control passed by the related event all possible states are passed there: function CustomDrawStateToPython(const ACustomDrawState: TCustomDrawState): PPyObject; procedure Append(const AList: PPyObject; const AString: string); var LItem: PPyObject; begin with GetPythonEngine do begin LItem := PyUnicodeFromString(AString); PyList_Append(AList, LItem); Py_XDecRef(LItem); end; end; var LCompType: PTypeInfo; LMin: integer; LMax: integer; LState: integer; begin Result := GetPythonEngine().PyList_New(0); LCompType := GetTypeData(TypeInfo(TCustomDrawState)).CompType^; LMin := LCompType^.TypeData^.MinValue; LMax := LCompType^.TypeData^.MaxValue; for LState := LMin to LMax do Append(Result, GetEnumName(LCompType, LState)); // <-- all enums are always set to state python attribute end; In my TreeView, when a node is selected, I've to change to white the font color otherwise text is hard to be sight: Either I completely misunderstood the functionality of that function or there was an oversight. Unfortunately Vcl.ComCtrls TCustomDrawItem is defined as a set with direct enumerators in the set so I didn't find a direct method to do: if CAST_TO_ENUM(LState) in TCustomDrawState then but with a forcing and a pointer you still get something working: function CustomDrawStateToPython(const ACustomDrawState: TCustomDrawState): PPyObject; procedure Append(const AList: PPyObject; const AString: string); var LItem: PPyObject; begin with GetPythonEngine do begin LItem := PyUnicodeFromString(AString); PyList_Append(AList, LItem); Py_XDecRef(LItem); end; end; function IsBitSet(Index: Integer; State: TCustomDrawState): Boolean; var P: PByte; begin if (Index < 0) or (Index >= SizeOf(TCustomDrawState) * 8) then Exit(False); P := @State; Result := (P^ and (1 shl Index)) <> 0; end; var LCompType: PTypeInfo; LMin: integer; LMax: integer; LState: integer; begin Result := GetPythonEngine().PyList_New(0); LCompType := GetTypeData(TypeInfo(TCustomDrawState)).CompType^; LMin := LCompType^.TypeData^.MinValue; LMax := LCompType^.TypeData^.MaxValue; for LState := LMin to LMax do begin if IsBitSet(LState, ACustomDrawState) then Append(Result, GetEnumName(LCompType, LState)); end; end; I'm not so smart in these things so if some Delphi guru has a better solution I'm ready to fix the code. Best regards.
  3. I need some help from Python + DelphiVCL guru. Some time ago I've made a new DelphiVCL control to use VTK with Python + VCL + VTK. To do that I've modified the Embarcadero's DelphiVCL package to add new control, called new library as cnc_vision_vcl to not override already installad DelphiVCL library and all worked fine. But I don't want to have a custom DelphiVCL and so I've tried to move the component in a delphivcl_ext project and at now same code does not work. What I've to in native Delphivcl code (which works) Create a clone of DelphiVCL projects as cnc_vision_vcl. Created new component WrapExtVTK.pas (attached). Modified source\vcl\WrapVclControls to import new unit: uses WrapDelphiTypes, WrapDelphiClasses, WrapDelphiWindows, WrapDelphiDataBind, WrapActions, WrapVclImgList, WrapVclControls, WrapVclGraphics, WrapVclForms, WrapVclActnList, WrapVclMenus, WrapVclStdCtrls, WrapVclComCtrls, WrapVclExtCtrls, WrapVclButtons, WrapVclGrids, WrapVclSamplesSpin, WrapVclWinXCtrls, WrapVclThemes, WrapVclDialogs, WrapVclMedia, WrapExtVTK; // <--- new unit Compiled and used new cnc_vision_vcl.pyd file In the cnc_vision_vcl a zip with working test All work fine but I want to move component in an "ext"tra package to leave untouched original delphivcl, so I've created a clean project which add almost the same code but when I try to create the VTKPanel object I obtains: self.vtk_panel = VTKPanel(self) ^^^^^^^^^^^^^^ AttributeError: Owner receives only Delphi objects In next chat the zip of entire project because I've reached post limits. WrapExtVTK.pas cnc_vision_vcl.zip
  4. shineworld

    VTK in DelphiVCL or DelphiFMX

    Hi all. Recently I've been using VTK to manage 3D Views. Unfortunately, I've found only info on how to use it with QT Pyside6 with QVTKRenderWindowInteractor. I will hope to use DelphiVCL (my first choice) or DelphiFMX + VTK. Do you have any idea on how to use VTK in a TForm or any other Windows-based window object?
  5. Hi all. What I love of Delphi is memory management and overall the integration of FastMM and related memory leak management. All my projects are Memory Leak Free (just thanks to reports of FastMM which permits me to create a better code). Now I'm migrating some programs to Python using DelphiVCL and I'm falling into odd memory leaks. In a Python (3.9.12) application that uses DelphiVCL (0.1.40) I've noticed a continuous memory leak in some simple operations with VCL objects like Checkbox. I've attached a very simple Python program that uses a Timer to constantly update the Enabled state of a Checkbox. In the sample, I've also added a const to enable a tracemalloc and confirm the continue grow of memory used by <Checkbox>.Enabled = True # enable/disable tracemalloc to exclude the memory impact of tracemalloc TRACEMALLOC_ENABLED = False By default, TRACEMALLOC_ENABLED is set to False to remove any impact of tracemalloc framework. If enabled, the first mouse down on the form capture the BASE snapshot of memory. Any following mouse down, report on console the comparison of current snapshot with the first. Initially, tracemalloc internals is in the top ten results, but after some time Checkbox1.Enabled = True gain the top. If I disable the interesting lines, commenting on them, any memory leak disappears: def __on_timer(self, sender): """ self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True self.CheckBox1.Enabled = True """ I've placed many CheckBox1.Enabled to exasperate the case-test but usually, I do this for a lot of controls in update events. This is the memory usage captured with Process Explorer on running Python process with TRACEMALLOC_ENABLED = False: test.zip
  6. shineworld

    delphivcl and PyLint

    Hi all, there is a way to inform PyLint about delphivcl types ? I've tried to add it to .pylintrc without results: [MASTER] # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. extension-pkg-allow-list= # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. (This is an alternative name to extension-pkg-allow-list # for backward compatibility.) extension-pkg-whitelist=cv2,delphivcl # Return non-zero exit code if any of these messages/categories are detected, # even if score is above --fail-under value. Syntax same as enable. Messages # specified are enabled, while categories only check already-enabled messages. fail-on= ... .. .
  7. shineworld

    OnMouseDown/Up events

    Hi, all I'm trying to use Python extension from Embarcadero: https://github.com/Embarcadero/DelphiVCL4Python installed in Python 3.9 (32 bits) with pip install delphivcl I was able to assign an OnClick event (in a Button): # creates jogs buttons btnXM = Button(self) btnXM.Parent = pgOne btnXM.Caption = 'X-' btnXM.Left = 8 btnXM.Top = 10 btnXP = Button(self) btnXP.Parent = pgOne btnXP.Caption = 'X+' btnXP.Left = btnXM.Left + btnXM.Width + 8 btnXP.Top = 10 def ClickEventHandler(Sender): pass btnXP.OnClick = self.jogClickEvent def MouseDownHandler(Sender, State, Button, X, Y): pass btnXP.OnMouseDown = MouseDownHandler but when reaches the btnXP.OnMouseDown Python notice this error: *** Remote Interpreter Reinitialized *** Traceback (most recent call last): File "D:\x\develop\qem\rosetta_cnc_1\python-scripts\pyipctcpjsonvcl-demo.py", line 249, in <module> main() File "D:\x\develop\qem\rosetta_cnc_1\python-scripts\pyipctcpjsonvcl-demo.py", line 241, in main f = MainForm(Application) File "D:\x\develop\qem\rosetta_cnc_1\python-scripts\pyipctcpjsonvcl-demo.py", line 67, in __init__ btnXP.OnMouseDown = MouseDownHandler AttributeError: Error in setting property OnMouseDown Error: No Registered EventHandler for events of type "TMouseEvent Looking at btnXP dir(): print(btnXP.__dir__()) ['__bound__', '__dir__', '__owned__', 'Action', 'AfterConstruction', 'Align', 'AlignDisabled', 'AlignWithMargins', 'Anchors', 'Assign', 'BeforeDestruction', 'BeginDrag', 'BeginInvoke', 'BiDiMode', 'BindMethodsToEvents', 'BoundsRect', 'BringToFront', 'Broadcast', 'Brush', 'Cancel', 'CanFocus', 'Caption', 'CheckNonMainThreadUsage', 'ClassInfo', 'ClassName', 'ClassNameIs', 'ClassParent', 'ClassType', 'CleanupInstance', 'Click', 'ClientHeight', 'ClientOrigin', 'ClientRect', 'ClientToParent', 'ClientToScreen', 'ClientWidth', 'CommandLinkHint', 'ComObject', 'ComponentCount', 'ComponentIndex', 'Components', 'ComponentState', 'ComponentStyle', 'Constraints', 'ContainsControl', 'ControlAtPos', 'ControlCount', 'Controls', 'ControlState', 'ControlStyle', 'Create', 'CreateParented', 'CreateParentedControl', 'CurrentPPI', 'Cursor', 'CustomHint', 'Default', 'DefaultHandler', 'DesignInfo', 'Destroy', 'DestroyComponents', 'Destroying', 'DisableAlign', 'DisabledImageIndex', 'DisabledImageName', 'DisabledImages', 'Dispatch', 'DisposeOf', 'Dock', 'DockClientCount', 'DockDrop', 'DockManager', 'DockOrientation', 'DockSite', 'DoubleBuffered', 'DragCursor', 'DragDrop', 'Dragging', 'DragKind', 'DragMode', 'DrawTextBiDiModeFlags', 'DrawTextBiDiModeFlagsReadingOnly', 'DropDownMenu', 'ElevationRequired', 'EnableAlign', 'Enabled', 'EndDrag', 'EndFunctionInvoke', 'EndInvoke', 'Equals', 'ExecuteAction', 'ExplicitHeight', 'ExplicitLeft', 'ExplicitTop', 'ExplicitWidth', 'FieldAddress', 'FindChildControl', 'FindComponent', 'FlipChildren', 'Floating', 'FloatingDockSiteClass', 'Focused', 'Font', 'Free', 'FreeInstance', 'FreeNotification', 'FreeOnRelease', 'GetChildren', 'GetControlsAlignment', 'GetEnumerator', 'GetHashCode', 'GetInterface', 'GetInterfaceEntry', 'GetInterfaceTable', 'GetNamePath', 'GetParentComponent', 'GetStyleName', 'GetSystemMetrics', 'GetTabControlList', 'GetTabOrderList', 'GetTextBuf', 'GetTextLen', 'Handle', 'HandleAllocated', 'HandleNeeded', 'HasParent', 'Height', 'HelpContext', 'HelpKeyword', 'HelpType', 'Hide', 'Hint', 'HostDockSite', 'HotImageIndex', 'HotImageName', 'ImageAlignment', 'ImageIndex', 'ImageMargins', 'ImageName', 'Images', 'InheritsFrom', 'InitiateAction', 'InitInstance', 'InsertComponent', 'InsertControl', 'InstanceSize', 'Invalidate', 'IsCustomStyleActive', 'IsDrawingLocked', 'IsImplementorOf', 'IsLightStyleColor', 'IsRightToLeft', 'Left', 'LockDrawing', 'LRDockWidth', 'ManualDock', 'ManualFloat', 'Margins', 'MethodAddress', 'MethodName', 'ModalResult', 'MouseInClient', 'MouseWheelHandler', 'Name', 'NewInstance', 'Observers', 'OnClick', 'OnContextPopup', 'OnDragDrop', 'OnDragOver', 'OnDropDownClick', 'OnEndDock', 'OnEndDrag', 'OnEnter', 'OnExit', 'OnGesture', 'OnKeyDown', 'OnKeyPress', 'OnKeyUp', 'OnMouseActivate', 'OnMouseDown', 'OnMouseEnter', 'OnMouseLeave', 'OnMouseMove', 'OnMouseUp', 'OnStartDock', 'OnStartDrag', 'Owner', 'Padding', 'PaintTo', 'Parent', 'ParentBiDiMode', 'ParentCustomHint', 'ParentDoubleBuffered', 'ParentFont', 'ParentShowHint', 'ParentToClient', 'ParentWindow', 'Perform', 'PixelsPerInch', 'PopupMenu', 'PreProcessMessage', 'PressedImageIndex', 'PressedImageName', 'QualifiedClassName', 'Realign', 'RedrawDisabled', 'ReferenceInterface', 'Refresh', 'RemoveComponent', 'RemoveControl', 'RemoveFreeNotification', 'Repaint', 'ReplaceDockedControl', 'SafeCallException', 'ScaleBy', 'ScaleFactor', 'ScaleForPPI', 'ScaleRectSize', 'ScaleValue', 'ScreenToClient', 'ScrollBy', 'SelectedImageIndex', 'SelectedImageName', 'SendToBack', 'SetBounds', 'SetDesignVisible', 'SetFocus', 'SetParentComponent', 'SetProps', 'SetSubComponent', 'SetTextBuf', 'Show', 'ShowHint', 'Showing', 'Style', 'StyleElements', 'StyleName', 'StylusHotImageIndex', 'StylusHotImageName', 'TabOrder', 'TabStop', 'Tag', 'TBDockHeight', 'ToList', 'Top', 'ToString', 'ToTuple', 'Touch', 'UndockHeight', 'UndockWidth', 'UnitName', 'UnitScope', 'UnlockDrawing', 'Update', 'UpdateAction', 'UpdateControlState', 'UseDockManager', 'UseRightToLeftAlignment', 'UseRightToLeftReading', 'UseRightToLeftScrollBar', 'VCLComObject', 'Visible', 'VisibleDockClientCount', 'Width', 'WindowProc', 'WordWrap'] OnMouseDown/Up are exposed.... I'm not able to understand what I've missed... Thank you in advance for suggestions
  8. shineworld

    python delphivcl development

    I'm converting a complex Python PySimpleGUI based program to Python using delphivcl module. In my initial test, the gained speed on UI things sees delphivcl as a very winner. But I need to add some missing features in delphivcl controls as well as the possibility to modify an Image (TImage) content sending it as an array of bitmap (NumPy arrays) instead to have to create a file.bmp and then load it with Image.Picture.LoadFromFile. Also, I need to add OnMouseDown/OnMouseUp in buttons. Gitting delphivcl, or delphifmx, I was not able to find the delphi building project, only the final files. Where I can find sources and projects to make delphivcl module and so to add new features?
×