Recent

Author Topic: timage zorder  (Read 7557 times)

jw

  • Full Member
  • ***
  • Posts: 126
timage zorder
« on: January 03, 2011, 11:17:36 pm »
at design time I created several buttons and some timages.  Is there a way programmatically to set one of the timages in front of the other components and timages created during design time after it so that the timage that is behind everything is now font of it all?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: timage zorder
« Reply #1 on: January 03, 2011, 11:30:29 pm »
BringToFront brings TImage at the topmost position of all graphics, but not of TButtons.

Probably you need to set TButtons invisible.
« Last Edit: January 03, 2011, 11:33:17 pm by typo »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: timage zorder
« Reply #2 on: January 04, 2011, 12:30:02 am »
Or you can place the image inside a TPanel which can be on top of buttons.

jw

  • Full Member
  • ***
  • Posts: 126
Re: timage zorder
« Reply #3 on: January 04, 2011, 03:14:42 am »
ok what i've got is an animated gif useing vampireimageing library playing in a timage.  Like typo said the bringtofront put it ahead of the other images but not above buttons or edit boxes.  So how do I embed this timage into a panel?

I suppose I could copy to the canvas but I think I'll lose the transparency anyway I'll give things a try thanks.
« Last Edit: January 04, 2011, 03:24:09 am by jw »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: timage zorder
« Reply #4 on: January 04, 2011, 01:25:36 pm »
There is no way you can draw transparent graphics on top of TButtons... I mean maybe can only if they are screenshot hacked, hiding them and drawing the buttons and then transparent image on top.

Or simply using TImages as a button, changing the picture when click happens etc, those can be under the transparent picture.
« Last Edit: January 04, 2011, 01:27:21 pm by User137 »

FangQ

  • Full Member
  • ***
  • Posts: 134
Re: timage zorder
« Reply #5 on: June 30, 2017, 10:50:45 pm »
I am trying to put a semi-transparent (png) TImage in front a set of components inside a GroupBox. I found all Tlabels are behind the image, but Teditbox and Tradiogroup are not. I saw in the earlier discussion that TButton can not be put behind TImage, what about TEditbox and TRadiogroups?

thanks

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: timage zorder
« Reply #6 on: June 30, 2017, 11:20:17 pm »
I am trying to put a semi-transparent (png) TImage in front a set of components inside a GroupBox. I found all Tlabels are behind the image, but Teditbox and Tradiogroup are not. I saw in the earlier discussion that TButton can not be put behind TImage, what about TEditbox and TRadiogroups?

thanks
any twincontrol descendant can not be put behind any tgraphiccontrol descendant.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

FangQ

  • Full Member
  • ***
  • Posts: 134
Re: timage zorder
« Reply #7 on: July 01, 2017, 04:00:19 am »
any twincontrol descendant can not be put behind any tgraphiccontrol descendant.

I see. thanks for the clarifications.

Handoko

  • Hero Member
  • *****
  • Posts: 5340
  • My goal: build my own game engine using Lazarus
Re: timage zorder
« Reply #8 on: July 01, 2017, 05:51:42 am »
If what you want to do is only to have an animated image on a button, you can try to use TBitButton + TImageList +  TTimer. Try my test.zip.

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Forms, Controls, Graphics, ExtCtrls, Buttons;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     BitBtn1: TBitBtn;
  16.     ImageList1: TImageList;
  17.     Timer1: TTimer;
  18.     procedure BitBtn1Click(Sender: TObject);
  19.     procedure Timer1Timer(Sender: TObject);
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.lfm}
  28.  
  29. { TForm1 }
  30.  
  31. procedure TForm1.BitBtn1Click(Sender: TObject);
  32. begin
  33.   BitBtn1.Caption := '';
  34.   Timer1.Enabled := not(Timer1.Enabled);
  35. end;
  36.  
  37. procedure TForm1.Timer1Timer(Sender: TObject);
  38. const
  39.   AnimIndex: Byte = 0;
  40. var
  41.   ABitmap: TBitmap;
  42. begin
  43.   // Set image
  44.   ABitmap := TBitmap.Create;
  45.   ImageList1.GetBitmap(AnimIndex, ABitmap);
  46.   BitBtn1.Glyph.Assign(ABitmap);
  47.   ABitmap.Free;
  48.   // Animate it
  49.   Inc(AnimIndex);
  50.   if (AnimIndex >= ImageList1.Count) then AnimIndex := 0;
  51. end;
  52.  
  53. end.
« Last Edit: July 01, 2017, 06:45:48 am by Handoko »

 

TinyPortal © 2005-2018