Forum > Win32/64

[Solved] Control positionning issue

(1/1)

Philippe1:
Hello
I have Lazarus 3.6 on a Windows 11 64 bits PC.
I have an application that has curious behavior. I compile for Windows 32 bits and when distributing the installator (Inno Setup), on some computers, the Tcomboboxes don't keep the same place as assigned on the form (by code neither by anchor). Is it an issue somebody else had ?
Thanks
Philippe

TRon:
Is this perhaps the same behaviour as described in this thread ?

Philippe1:
Hello,
This is an up for my post. I solved the issue by creating the 3 comboboxes at runtime.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses   {$IFDEF UNIX}  cthreads,clocale,  {$ENDIF}  interfaces, // this includes the LCL widgetset   Windows, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, IniFiles,  LCLTranslator, Graph, RegExpr, StdCtrls, ExtCtrls, MaskEdit, LCLType, LCLIntf,  Variants, Math, LR_Class, LR_PGrid, DBGrids, fpjson, JSONParser,  blcksock, FileUtil, unit2, Process, fphttpclient ;  //LR_Class, LR_DBSet, Grids, Variants, Math, GetText, LR_DSet, LR_Desgn;   type       TArrayStr = array of string;      { TForm1 }      TForm1 = class(TForm)            btnExit: TButton;            btnClear: TButton;            BtCalculate: TButton;            BtPrint: TButton;.../...            LbDelta: TLabel;            LbMTAccuracy: TLabel;            LbETAccuracy: TLabel;            LbSelectLanguage: TLabel;            procedure CbETAccuracyChange(Sender: TObject);            procedure CbLanguageChange(Sender: TObject);            procedure CbMTAccuracyChange(Sender: TObject); .../...    private           CbLanguage: TCombobox;           CbETAccuracy: TComboBox;           CbMTAccuracy: TComboBox;           MaskEditArray: array[1..40] of TMaskEdit;  // Tableau de 40 TMaskEdit           procedure GenerateReport;    public    end;  
Then

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{Procedure of TForm} procedure TForm1.FormCreate(Sender: TObject);var  i, index, intLine: Integer;  ScreenWidth, ScreenHeight: Integer;  OSInfo: TOSVersionInfo;  Labelx: array[1..10] of Tlabel;  bolOK: Boolean; begin     DefaultFormatSettings.DecimalSeparator := '.';     OSInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);     if GetVersionEx(OSInfo) then       OSName := 'Windows'     else       OSName := 'Autre';    {    gd := Detect;    InitGraph(gd, gm, '');     if GraphResult <> grOk then    begin         ShowMessage('Erreur d''initialisation graphique.');         halt(1);    end; }     ScreenWidth := Screen.Width - 400;    ScreenHeight := Screen.Height - 100;    //width := GetMaxX + 1;    //height := GetMaxY + 1;    Form1.Width := ScreenWidth - 100;    Form1.Height := ScreenHeight - 100; .../...     // Créer l'instance de TComboBox    CbLanguage := TComboBox.Create(Form1);     // Définir le parent pour qu'il soit visible    CbLanguage.Parent := Self;      CbLanguage.Left := LbSelectLanguage.Left;     CbLanguage.Top := LbETAccuracy.Top;     CbLanguage.Width := LbSelectLanguage.Width;     CbLanguage.Clear;     CbLanguage.Items.Add('English');     CbLanguage.Items.Add('Français');     CbLanguage.Items.Add('Deutch');     CbLanguage.OnChange := @CbLanguageChange;      strValeur := OpenReadInI('Parametres', 'Language', 'English');     case strValeur of          'English': begin                     lang := 'en';                     CbLanguage.ItemIndex:= 0;                     end;          'Français': begin                      lang := 'fr';                      CbLanguage.ItemIndex:= 1;                     end;          'Deutch': begin                    lang := 'de';                    CbLanguage.ItemIndex:= 2;                    end;     else         begin              lang := 'en';              CbLanguage.ItemIndex:= 0;         end;     end;     CbMTAccuracy := TComboBox.Create(Form1);      // Définir le parent pour qu'il soit visible     CbMTAccuracy.Parent := Self;     CbMTAccuracy.Left := LbDelta.Left;     CbMTAccuracy.Top := LbMTAccuracy.Top;     CbMTAccuracy.Width := LbDelta.Width;     CbMTAccuracy.Clear;     CbMTAccuracy.Items.Add('1/100');     CbMTAccuracy.Items.Add('1/1000');     CbMTAccuracy.Items.Add('1/10000');     CbMTAccuracy.Items.Add('1/100000');     CbMTAccuracy.Items.Add('1/1000000');     strValeur := OpenReadInI('Parametres', 'MT_accuracy', '1/1000');     CbMTAccuracy.Text := strValeur;     case CbMTAccuracy.Text of           '1/100':             begin               strMaskMT := '!00:00:00.00;1;_';               MTPrecision := 2;             end;         '1/1000':             begin               strMaskMT := '!00:00:00.000;1;_';               MTPrecision := 3;             end;          '1/10000':             begin               strMaskMT := '!00:00:00.0000;1;_';               MTPrecision := 4;             end;          '1/100000':             begin               strMaskMT := '!00:00:00.00000;1;_';               MTPrecision := 5;             end;          '1/1000000':             begin               strMaskMT := '!00:00:00.000000;1;_';               MTPrecision := 6;             end;     end;     // Créer l'instance de TComboBox     CbETAccuracy := TComboBox.Create(Form1);      // Définir le parent pour qu'il soit visible     CbETAccuracy.Parent := Self;     CbETAccuracy.Left := LbDelta.Left;     CbETAccuracy.Top := LbETAccuracy.Top;     CbETAccuracy.Width := LbDelta.Width;      CbETAccuracy.Clear;     CbETAccuracy.Items.Add('1/1000');     CbETAccuracy.Items.Add('1/10000');     CbETAccuracy.Items.Add('1/100000');     CbETAccuracy.Items.Add('1/1000000');     strValeur := OpenReadInI('Parametres', 'ET_accuracy', '1/1000');     CbETAccuracy.Text := strValeur;     case CbETAccuracy.Text of          '1/1000':             begin               strMaskET := '!00:00:00.000:;1;_';               ETPrecision := 3;             end;          '1/10000':             begin               strMaskET := '!00:00:00.0000;1;_';               ETPrecision := 4;             end;          '1/100000':             begin               strMaskET := '!00:00:00.00000;1;_';               ETPrecision := 5;             end;          '1/1000000':             begin               strMaskET := '!00:00:00.000000;1;_';               ETPrecision := 6;             end;     end; 
I tested on several PCs with different screen resolution and it seems to be working.
There is definitely an issue when the controls are designed into the form.

Thanks for helping
Philippe    :)

Navigation

[0] Message Index

Go to full version