Recent Posts

Pages: [1] 2 3 ... 10
General / Re: Combobox: A value/key for each item?
« Last post by jamie on Today at 03:02:02 am »
Use a Tcombobox in OwnerDraw mode..

Populate the list with the Visible Text = HiddenText;

When painting the list only paint the TEXT for each cell that gets called for a paint job.

For example of one line


And using the items you can look at the KEYS and VALUES array
so when painting each item you paint only the KEYS and when the user select the item you can use the VALUES to obtain the M1 for example..

 I thought this would be a good idea to use this event so that when loading from resource or some other sources it would give me the chance to make changes during the creation process..

  It appears that if I load from resource (lfm) designed info or manual add one via the normal channels this event gets called but always has NIL object.

  Drop a TreeView on the form, add a couple of items and implement the OnCustomCreateItem event.
  With mine Lazarus as the items are being created and populating the Tree this event gets called but it has a nil pointer..

 Can someone explain to me where I am going wrong using this event ?

Thanks everybody for the elaboration! I learned from it!

Case solved for me.  :)
macOS / Mac OS X / Re: Impossible to open a project
« Last post by trev on Today at 02:29:25 am »
It seems Lazarus have a problem with MacOS BIG

Do you mean the macOS Big Sur Beta?

If so, then what I have already posted above are the two solutions - either add the Lazarus excecutable to Full Disk Access or move the project directory out of the user privacy protected Downloads directory.

See my attached image (from Big Sur Beta 3). Lazarus then has no problem opening projects in user privacy protected directories.

General / mcGrid: Alignement of cells
« Last post by Jvan on Today at 02:26:10 am »
I want to center the content of the cells, so I used this code:

Code: Pascal  [Select][+][-]
  2. procedure TfrmMain.DrawCellTextHandler(Sender: TObject; ACol, ARow: Integer;
  3.   ARect: TRect; AState: TGridDrawState; AText: String; var Handled: Boolean);
  4. var
  5.   ts: TTextStyle;
  6.   x, y: Integer;
  7.   bmp: TBitmap;
  8. begin
  9.   Handled := True;
  10.   if (ACol in [1..2]) and (ARow = 0) then
  11.   begin
  12.     // Centered text
  13.     ts := grdAstCont.Canvas.TextStyle;
  14.     ts.Alignment := taCenter;
  15.     ts.Layout := tlCenter;
  16.     x := (ARect.Left + ARect.Right) div 2;
  17.     y := (ARect.Top + ARect.Bottom) div 2;
  18.     grdAstCont.Canvas.TextRect(ARect, x, y, AText, ts);
  19.   end else if (ACol in [3..4]) and (ARow = 0) then begin
  20.     // Centered text
  21.     ts := grdAstCont.Canvas.TextStyle;
  22.     ts.Alignment := taCenter;
  23.     ts.Layout := tlCenter;
  24.     x := (ARect.Left + ARect.Right) div 2;
  25.     y := (ARect.Top + ARect.Bottom) div 2;
  26.     grdAstCont.Canvas.TextRect(ARect, x, y, AText, ts);
  27.   end;
  28.   Handled := False;
  29. end;

But the result is the image.

I did answer to your topic in uos forum.

Anyway, here is the same answer:

There is a Lazarus LCL webplayer demo:

There is also a console webplayer demo:

General / Re: KeyUp event: How to set "Key = null"?
« Last post by Jvan on Today at 01:55:37 am »
General / Re: KeyUp event: How to set "Key = null"?
« Last post by skalogryz on Today at 01:42:33 am »
Code: Pascal  [Select][+][-]
  1. Key := 0;
General / Re: Combobox: A value/key for each item?
« Last post by lainz on Today at 01:31:40 am »
You can use Items.Objects property to store objects for each item-
General / KeyUp event: How to set "Key = null"?
« Last post by Jvan on Today at 01:30:50 am »
I need to get the Key value, then set null, something like this:

Code: Pascal  [Select][+][-]
  1.   keyVal := Key;
  2.   Key := NULL;
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018