- This topic has 15 replies, 2 voices, and was last updated 2 years, 10 months ago by Support.
-
AuthorPosts
-
November 21, 2021 at 7:37 am #70502Koushik HalderParticipant
Please find my code as follows:
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, sSkinProvider, sSkinManager, Vcl.StdCtrls, Vcl.Mask, sMaskEdit, sCustomComboEdit, sComboBox, Vcl.Menus, sEdit, acntTypes; type TForm1 = class(TForm) PopupMenu1: TPopupMenu; M1: TMenuItem; M2: TMenuItem; M3: TMenuItem; sComboBox1: TsComboBox; sSkinManager1: TsSkinManager; sSkinProvider1: TsSkinProvider; sEdit1: TsEdit; procedure FormCreate(Sender: TObject); procedure sComboBox1GetItemDrawData(Sender: TObject; var ItemDrawData: TacItemDrawData); procedure sSkinManager1GetMenuExtraLineData(FirstItem: TMenuItem; var SkinSection, Caption: string; var Glyph: TBitmap; var LineVisible: Boolean); procedure sSkinManager1GetPopupItemData(Item: TMenuItem; State: TOwnerDrawState; ItemData: TacMenuItemData); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin PopupMenu1.AutoPopup := true; sComboBox1.Items.BeginUpdate; try begin sComboBox1.Items.Clear; sComboBox1.Items.Add('A. Fox'); sComboBox1.Items.Add('B. Tiger'); sComboBox1.Items.Add('C. Elephant'); end finally begin sComboBox1.Items.EndUpdate; end end; sComboBox1.Font.Color := clBlue; sComboBox1.Skindata.CustomFont := true; sSkinManager1.MenuSupport.UseExtraLine := true; end; procedure TForm1.sComboBox1GetItemDrawData(Sender: TObject; var ItemDrawData: TacItemDrawData); begin // end; procedure TForm1.sSkinManager1GetMenuExtraLineData(FirstItem: TMenuItem; var SkinSection, Caption: string; var Glyph: TBitmap; var LineVisible: Boolean); begin // end; procedure TForm1.sSkinManager1GetPopupItemData(Item: TMenuItem; State: TOwnerDrawState; ItemData: TacMenuItemData); begin case Item.Tag of 1: begin // ItemData.Font.Style := []; ItemData.Font.Size := 9; ItemData.Font.Color := clBlue; end; 2: begin ItemData.Font.Style := []; ItemData.Font.Size := 9; ItemData.Font.Color := clBlue; end; 3: begin ItemData.Font.Style := []; ItemData.Font.Size := 9; ItemData.Font.Color := clBlue; end; end; end; end.
I need to make ComboBox items as follows:
A. Fox
B. Tiger
C. Elephantand need to make PopupMenu items as follows:
A. Fox
B. Tiger
C. ElephantHow this can be implemented.
November 24, 2021 at 2:29 pm #70526SupportKeymasterHello! Could you upload a full project, please?
December 3, 2021 at 9:33 am #70556Koushik HalderParticipantPlease find attached herewith my project. My sComboBox1 items will be as follows:
A. Fox
B. Tiger
C. Elephant
Any how I have coded my requirement in sComboBox1 but unable to get my required result as I mentioned above. Please help to rectify.But no option for HTML Coded PopupMenu Items. So you are requested to design your own PopupMenu.
Attachments:
You must be logged in to view attached files.December 4, 2021 at 7:06 am #70574SupportKeymasterThank you.
Try this code in the OnGetItemDrawData:procedure TForm1.sComboBox1GetItemDrawData(Sender: TObject; var ItemDrawData: TacItemDrawData); begin ItemDrawData.HtmlText := ItemDrawData.Text; // Copy text for a current Item ItemDrawData.Text := ''; // Use HtmlText end;
This event is called for an each Item and text should be different for each Item.
By the way, ‘Cyan’ color is not handled. Main 16 colors are added for parsing.
You can use a number format for colors there.December 4, 2021 at 10:31 am #70576Koushik HalderParticipantThanks for your code. Now sComboBox works perfectly. But PopupMenu Items customization remaining. Please launch your own PopupMenu.
December 5, 2021 at 8:05 am #70589Koushik HalderParticipantNow another problem has come to me. When I am selecting any item in ComboBox it shows HTML Coded Text for example for
sComboBox1.Items[0]
it shows<b><font color=Yellow>A.</font></b><font color=Red> Fox</font>
instead of A. Fox[/color]. But your ComboBox Demo is OK. I am trying to find it out what you have coded more but unable to find. Please mention.- This reply was modified 2 years, 11 months ago by Koushik Halder.
December 8, 2021 at 8:55 am #70601SupportKeymasterMaybe you can upload another demo?
December 8, 2021 at 10:02 am #70602Koushik HalderParticipantPlease find my project attached herewith.
Attachments:
You must be logged in to view attached files.December 10, 2021 at 7:07 pm #70612Koushik HalderParticipantI have updated my project.
Attachments:
You must be logged in to view attached files.December 12, 2021 at 8:15 am #70615SupportKeymasterThank you, I’ll check it soon.
December 23, 2021 at 5:48 am #70661Koushik HalderParticipantPlease do the needful.
January 3, 2022 at 7:12 am #70671SupportKeymasterLook, the Text property receives html tags from the Items list, when selected.
We should think how to avoid this standard behavior…
Maybe new property like ‘MakeTextPlain’ will help?January 3, 2022 at 12:16 pm #70678Koushik HalderParticipantYes! Please implement it.
January 8, 2022 at 8:06 am #70694Koushik HalderParticipantThank you! I have checked and it is working fine.
January 10, 2022 at 10:29 am #70701Koushik HalderParticipantMakeTextPlain
is working partially. If anyComboBox ItemIndex
is other than -1 i.e any item is selected then if I click any component likeButton
,Edit
andMemo
etc. then selected Item ofComboBox
again becomesHTML RAW DATA
not the plain text.January 12, 2022 at 8:06 am #70707SupportKeymasterHi! I will check it.
-
AuthorPosts
- You must be logged in to reply to this topic.