Crazy!
I tracked down what was happening. There is a caption_assign method on the base label class. This is triggered before the init event. The code in the caption_assign did not change the height of the label. It did adjust the width of a label. When the width was adjusted the height would change, but there is not a way to capture that change and where it comes from. I stepped through the code and never saw anything when I put an height_assign method in there.
So to correct this, I have to change the width of the label after the form has initialized.
BINDEVENT(THISFORM, "INIT", THIS, "AFTER_FORM_INIT", 1)
Awesome, it's working.
Well, now I'm trying to launch a form that takes a parameter.
Local nId nId = 2547 DO FORM TestForm with nId
That errors with something that makes no sense. (Function argument value, type, or count is invalid.)
DO FORM TestForm with 2547
That works without an error.
Should I attempt to bind to the forms Show event? Should I trigger something in the forms visible_assign code?
I went with the visible_assign code today and the error isn't happening anymore.
So, if you need to resize something that needs to reference the parent of an object, don't do it in the child init method. Some properties don't stay as you suspect them to.
Have Fun! Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Tracy Pearson Sent: Friday, July 09, 2021 9:44 AM To: profoxtech@leafe.com Subject: RE: VFP Label Height changes
Frank,
I originally went down that path. Then I put some code in the INIT of the control on the form. ?PROGRAM(PROGRAM(-1)),"Height:",THIS.Height DODEFAULT()
That was when I decided I needed to figure out a hack to get around the problem. If it is telling me the height of the control at the INIT was 17 instead of 19 that was a problem.
When I changed the Height to be overwritten to 19 in the cNavButton class, the above code correctly showed 19. When I reset Height to default, it again showed 17.
I spent a few hours attempting to reproduce it in a new project. I am not seeing the behavior currently. I'll may get some more time this weekend to continue my efforts.
Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Frank Cazabon Sent: Thursday, July 08, 2021 10:48 AM To: profoxtech@leafe.com Subject: Re: VFP Label Height changes
Tracy,
you able to recreate this with base VFP controls and then maybe add in your controls one by one to see where it's happening?
Maybe there's some resizing code running or bindevents that does something "special"?
Frank.
Frank Cazabon
On 07/07/2021 4:46 pm, Tracy Pearson wrote:
On cLabel and default everywhere used in this scenario. FontName: Segoe UI FontSize: 10
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of
Richard
Kaye Sent: Wednesday, July 07, 2021 4:40 PM To: profoxtech@leafe.com Subject: RE: VFP Label Height changes
What is the default height for the font name and size used?
--
rk
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Tracy Pearson Sent: Wednesday, July 7, 2021 3:37 PM To: profoxtech@leafe.com Subject: RE: VFP Label Height changes
Autosize = .F. Alignment is centered The Label class doesn't have IntegralHeight.
Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of
Richard
Kaye Sent: Wednesday, July 07, 2021 3:17 PM To: profoxtech@leafe.com Subject: RE: VFP Label Height changes
Autosize? IntegralHeight?
--
rk
[excessive quoting removed by server]