Control inside control... lazarus / 31-LCL ---------------------------------------------------------------------- Espectr0 · 2023-04-01 11:20 Hola, I have a component (TCustomEdit) that I add a TUpDown inside with the following code (constructor): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   FUpDown := TUpDown.Create(Self);  with FUpDown do  begin    SetSubComponent(True);    Width        := 14;    Height       := Self.Height;    Increment    := 1;    Flat         := True;  end;  and (AdjustClientRect): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  inherited;  with FUpDown do  begin    Align   := alNone;    Anchors := [akLeft, akTop];    Parent  := Self.Parent;    Left    := Self.Left + Self.Width - Width;    Top     := Self.Top;    Height  := Self.Height;  end;end;  It works correctly but the error that I found is when changing the border of the TCustomEdit (runtime and desigtime) to bsNone, TUpDown disappears. Also if I put it back to bsSingle it does not appear...  Any idea how to solve it? Thanks! ---------------------------------------------------------------------- jamie · 2023-04-01 13:35 We are back to the parent issue again, only this time you must use the SELF only as the parent and make all of your locations work with the client of your parent, not the Parent of the parent etc.  This is only assuming that you are actually attempting to get the updown control to sit inside of the control under it. btw. The TUpDown does have an Associate property that allows it to hug itself to a side of a control. ---------------------------------------------------------------------- Espectr0 · 2023-04-01 13:55 If I understood modified the following line: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Parent  := Self.Parent; to Parent  := Self; but now TUpDown does not appear  QuoteThe TUpDown does have an Associate property that allows it to hug itself to a side of a control. That's right, but I want to put it inside instead of next to it ---------------------------------------------------------------------- Blaazen · 2023-04-01 14:48 This works: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    UpDown1.Parent:=Edit1;    UpDown1.Anchors:=[akRight];  UpDown1.AnchorSideRight.Control:=Edit1;  UpDown1.AnchorSideRight.Side:=asrRight;  UpDown1.AnchorVerticalCenterTo(Edit1); However, I'm not sure if placing TUpDown on the TEdit will work well on all widgetsets. It may cause some visual glitches, disappearing, maybe. ---------------------------------------------------------------------- Blaazen · 2023-04-01 15:13 It work in Qt4. GTk2 and GTk3 do not allow you to have TEdit as a Parent of anything. ---------------------------------------------------------------------- jamie · 2023-04-01 15:28 Yes, that is true also in Windows, I forgot about that. It's a restriction of the LCL, not windows.  Wouldn't something like a spin edit work but maybe for text in a Stringlist ? ---------------------------------------------------------------------- Espectr0 · 2023-04-01 15:41 so I should use it next to it and not inside the control ---------------------------------------------------------------------- jamie · 2023-04-01 15:55 Yes, exactly.  If I knew exactly what you are trying to do I can punch out an example.  if for example, you wanted a scrolling combobox using the simple form with no drop down and also give you an editor feature, you can attached that to the side of a combobox.Simple style. You can stretch the box out of course to see the list of choices etc. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.UpDown1ChangingEx(Sender: TObject; var AllowChange: Boolean;  NewValue: SmallInt; Direction: TUpDownDirection);begin  Case Direction of   UpdUp:With ComboBox1 do    if ItemIndex >=0 Then ItemIndex := ItemIndex-1;   UpdDown:With ComboBox1 Do    If ItemIndex < Items.Count-1 Then ItemIndex := ItemIndex+1;  end;end;                                           Something like that. in that case, you do not associate the arrows with the combobox, just attached them. ---------------------------------------------------------------------- Espectr0 · 2023-04-01 16:35 I tell you, in my application I have a time component (tcustomedit + tupdown + functions), currently to put it to the side use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     FUpDown.AnchorToCompanion(akLeft, FSpinSpacing, Self);    FUpDown.AnchorVerticalCenterTo(Self);  and it works perfectly now I wanted to implement "onmouseenter/leave" to show or hide "tupdown". If I implement it in the tedit when exiting I can no longer place the mouse over the tupdown because is hidden by my tedit mouseleave I don't know if I explain myself with my bad English