picyka Posted December 9, 2022 Share Posted December 9, 2022 Is there a way to make a css, where the buttons have the width according to the caption, and they must be aligned in the center TestCase.rar Quote Link to comment Share on other sites More sharing options...
picyka Posted December 9, 2022 Author Share Posted December 9, 2022 procedure TMainForm.UniButton1Click(Sender: TObject); begin UniListButtom.Items.Add; UniListButtom.Items[UniListButtom.Items.Count-1].ButtonId := UniListButtom.Items.Count + 1; UniListButtom.Items[UniListButtom.Items.Count-1].ImageIndex := 0; UniListButtom.Items[UniListButtom.Items.Count-1].Caption :='teste0'; UniListButtom.Items.Add; UniListButtom.Items[UniListButtom.Items.Count-1].ButtonId := UniListButtom.Items.Count + 1; UniListButtom.Items[UniListButtom.Items.Count-1].ImageIndex := 0; UniListButtom.Items[UniListButtom.Items.Count-1].Caption :='teste1'; end; Another detail that the inclusion of items at runtime does not work Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 10, 2022 Share Posted December 10, 2022 7 hours ago, picyka said: and they must be aligned in the center Hello, Use container, for example UniContainerPanel 1-> Align = alTop, AlignmentControl = uniAlignmentClient, Layout = hbox, LayouAttribs -> Align = middle, Pack = center UniSegmentedButton1 -> Align = alNone Result: Quote Link to comment Share on other sites More sharing options...
picyka Posted December 11, 2022 Author Share Posted December 11, 2022 No dia 9/12/2022 às 17:54, picyka disse: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniListButtom.Items.Add; UniListButtom.Items[UniListButtom.Items.Count-1].ButtonId := UniListButtom.Items.Count + 1; UniListButtom.Items[UniListButtom.Items.Count-1].ImageIndex := 0; UniListButtom.Items[UniListButtom.Items.Count-1].Caption :='teste0'; UniListButtom.Items.Add; UniListButtom.Items[UniListButtom.Items.Count-1].ButtonId := UniListButtom.Items.Count + 1; UniListButtom.Items[UniListButtom.Items.Count-1].ImageIndex := 0; UniListButtom.Items[UniListButtom.Items.Count-1].Caption :='teste1'; end; Outro detalhe que a inclusão de itens em tempo de execução não funciona And how to do the inclusion and exclusion? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2022 Share Posted December 11, 2022 20 minutes ago, picyka said: And how to do the inclusion and exclusion? Sorry? Quote Link to comment Share on other sites More sharing options...
picyka Posted December 11, 2022 Author Share Posted December 11, 2022 1 minute ago, Sherzod said: Sorry? I need to add/remove items to a UniSegmentedButton at runtime. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 11, 2022 Share Posted December 11, 2022 There is also a question on the topic. How to process and find out which button was clicked? I need to perform actions depending on the button pressed. Quote Link to comment Share on other sites More sharing options...
picyka Posted December 11, 2022 Author Share Posted December 11, 2022 2 minutes ago, artem_niko said: Há também uma pergunta sobre o tema. Como processar e descobrir qual botão foi clicado? Preciso executar ações dependendo do botão pressionado. event = Pressed 1 Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 11, 2022 Share Posted December 11, 2022 9 minutes ago, picyka said: event = Pressed With case...of? Quote Link to comment Share on other sites More sharing options...
picyka Posted December 11, 2022 Author Share Posted December 11, 2022 2 minutes ago, artem_niko said: With case...of? case Sender.ButtonId of end; 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2022 Share Posted December 11, 2022 3 hours ago, picyka said: I need to add/remove items to a UniSegmentedButton at runtime. Need to check. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 12, 2022 Share Posted December 12, 2022 15 hours ago, picyka said: I need to add/remove items to a UniSegmentedButton at runtime. Hello, Try this approach: procedure TMainForm.UniButton1Click(Sender: TObject); var btnItem: TUniButtonItem; begin // Add with UniSegmentedButton1 do begin btnItem := TUniButtonItem(Items.Add); JSInterface.JSCall('removeAll', []); Items.InsertButtons(JSControl, Images, False); // Set the caption here btnItem.Caption := 'Button' + Items.Count.ToString(); end; end; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.