Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an issue with TToolBar #77

Open
fansxs opened this issue Sep 26, 2023 · 2 comments
Open

There is an issue with TToolBar #77

fansxs opened this issue Sep 26, 2023 · 2 comments
Assignees

Comments

@fansxs
Copy link

fansxs commented Sep 26, 2023

When the property PixelsPerInch of Form is 96, TToolBar can display normally. However, when it is not 96, such as 120, the program will encounter an error.
2

@lmbelo
Copy link
Member

lmbelo commented Sep 26, 2023

Can you share your code, please?

@lmbelo lmbelo closed this as completed Sep 26, 2023
@lmbelo lmbelo reopened this Sep 26, 2023
@fansxs
Copy link
Author

fansxs commented Sep 27, 2023

Sure.

object Form1: TForm
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 205
ClientWidth = 382
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 120 ///HERE////
TextHeight = 16
object ToolBar1: TToolBar
Left = 0
Top = 0
Width = 382
Height = 29
Caption = 'ToolBar1'
TabOrder = 0
ExplicitLeft = 160
ExplicitTop = 120
ExplicitWidth = 150
end
end

Generate it to pydfm file, then load it from python code.

import os
from delphivcl import *

class Form1(Form):

def __init__(self, owner):
    self.ToolBar1 = ToolBar(self)
    self.LoadProps(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Unit1.pydfm"))

def main():
Application.Initialize()
Application.Title = 'Project1'
MainForm = Form1(Application)
MainForm.Show()
FreeConsole()
Application.Run()

if name == 'main':
main()

@lmbelo lmbelo self-assigned this Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants