Forum > LCL

TControl and TGraphic Control creation issue

<< < (2/7) > >>

jcdammeyer:

--- Quote from: jamie on April 25, 2021, 05:35:17 pm ---maybe bad compiler..

 There has been recent corrections made with the compiler for arm but I think you need to get the most recent truck for that and of course you will need to rebuild all of the LCL code etc with that compiler..

--- End quote ---

Possibly.  But this seems too obvious a problem not to have shown up a long time ago.  I'll whack away at it for a bit.  I'd like to know why it's broken.  Not just blindly type something in to fix it.

jamie:
I got looking at  your problem a little closer..

can you try instead of using "/" as the divider and use "DIV" instead ?

Also, I guess another question would be is did you use the IDE to design the class or are you doing this at the raw level ?

The IDE needs to read the values from the resource of the file which is attached at the end of the application file. This is done during the Construction period so that means you either need to use the OnCreate of the form there by allowing this process to complete or if you are overriding the constructor then you need to ensure you call the inherited first..

 But if you are doing this at RAW metal level, then of course these WIDTH, HEIGHT etc values will be 0 at start.

jcdammeyer:
Just headed out on doggy walk so I'll check when I get back. 

The odd thing is the exact same code works with Lazarus for Windows and I've just been through the files doing some tweaking and {$IFDEF} work so now it again compiles with Delphi 10.3 or Lazarus on the PC.  I'll copy that project folder back onto the Beagle and the Pi and give it another try.

jcdammeyer:
I just downloaded the folder with the project onto a LinuxCNC PC.  Had to install the dsLED component in order to get the form to show up.  And it shows up just like it does on the Beagle and that's different from the PC Lazarus or Delphi version.

Since it doesn't show up correctly as a form I think that's the first place to look.  Why is it that on a PC with Lazarus this form is correct while on Linux based systems it's not.  It implies the write once compile anywhere module is not working correctly.

I'll go through the tutorial along with this part
https://wiki.lazarus.freepascal.org/How_To_Write_Lazarus_Component#Step_3:_Create_icons_for_the_package
because the package icons show up correctly for WIN-10 Delphi but not Lazarus at all.

Baby steps I guess.

jcdammeyer:
I broke the project down to be a bit simpler since I couldn't figure out why the 7 segment display was offset from the rectangle.  Quite by accident when I was moving things around on the form I stumbled on the underlying root of the problem.  Don't have a solution yet though.

I created a form with just the single 7 segment component created from scratch on the BBB with Lazarus 2.0.10.  I also added another component that has a 6 digit display and works properly; to try and figure out what's different...

Anyway, the basic component works wonderfully if the component is placed at 0,0.  Click the button and the Value is incremented each time the LED is switched to ON. 

But drag the component away from the 0,0 position and the segments remain in place and when recompiled still changed but not locked inside the rectangle.

This only happens on the Linux based BBB and Raspberry Pi.  The same code and component on a PC has the segments dragging with the rectangle.  Same code in Delphi too. 

So something deep inside the TGraphicControl doesn't work in either the IDE or in the running application. 

More when I figure it out.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version