Recent

Author Topic: [SOLVED] Font Size - Does Nothing  (Read 2095 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
[SOLVED] Font Size - Does Nothing
« on: July 04, 2020, 04:28:52 pm »
Hi,

When I change a value in a font size combobox... nothing happens

I am converting the font size text to an integer.

What am I missing?

Code: Pascal  [Select][+][-]
  1. var
  2.  fnt   :  TFontParams;
  3. begin
  4.   txtNote1.GetTextAttributes(txtNote1.SelStart, fnt);
  5.   txtNote1.SetRangeParams (txtNote1.SelStart, txtNote1.SelLength,[tmm_Styles, tmm_Color],
  6.   '',StrToInt(cbFontSize.Text),clBlack,[],[]);


Thanks in advanced
« Last Edit: July 04, 2020, 05:23:31 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: Font Size - Does Nothing
« Reply #1 on: July 04, 2020, 05:09:42 pm »
Okay... got this to work on normal button.
But it doesn't work on a combo box change event - generates an error

See here:
https://forum.lazarus.freepascal.org/index.php?board=71.0

Code that woks on button.

Code: Pascal  [Select][+][-]
  1. var
  2.   fnt : TFontParams;
  3. begin
  4.   fnt.Name:='';
  5.   fnt.Style:= []; //[fsBold or Italic];
  6.   fnt.Size:=24;
  7.  
  8.   txtNote1.SetTextAttributes(txtNote1.SelStart, txtNote1.SelLength, fnt);
  9.   txtNote1.SetFocus();
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: Font Size - Does Nothing
« Reply #2 on: July 04, 2020, 05:23:18 pm »
Well... i found a workaround for the combobox.
Instead of using change event... I am using "onSelect"... that bypasses the error (or bug)
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

 

TinyPortal © 2005-2018