x11 Posted December 20, 2020 Share Posted December 20, 2020 У формы есть встроенные кнопки (TitleButtons), которые привязаны к TAction. В событии onShow я что-то проверяю и выполняется строка actPhoneAdd.Visible := false; При этом кнопка формы, которая привязана к этому действию, всё равно остается видимой. По идее, кнопка должна тоже поменять свое значение видимости. Мало того, когда я принудительно прячу кнопку self.TitleButtons[0].Visible := false; кнопка всё равно видна Quote Link to comment Share on other sites More sharing options...
x11 Posted December 22, 2020 Author Share Posted December 22, 2020 Похожая проблема у ToolButtons только уже в дизайне. У панели есть кнопки в заголовке. Выбираю у кнопки Action, и заполняется только ImageIndex, а свойство Hint остается пустым. Quote Link to comment Share on other sites More sharing options...
x11 Posted January 8, 2021 Author Share Posted January 8, 2021 такая же проблема и у кнопок в uniDBGrid.ActionColum.Button выбираю action,но hint не заполняется Quote Link to comment Share on other sites More sharing options...
x11 Posted January 19, 2021 Author Share Posted January 19, 2021 И это еще не все. Кнопка не скрывается в событии UnimFormShow. Проверяю отладчиком, строка выполняется Self.TitleButtons[0].Visible := false; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 19, 2021 Share Posted January 19, 2021 27 minutes ago, x11 said: Кнопка не скрывается в событии UnimFormShow. Проверяю отладчиком, строка выполняется Пока попробуйте использовать это решение... 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted January 20, 2021 Author Share Posted January 20, 2021 странно, три года прошло и до сих пор проблему не исправили Quote Link to comment Share on other sites More sharing options...
x11 Posted January 20, 2021 Author Share Posted January 20, 2021 11 hours ago, Sherzod said: Пока попробуйте использовать это решение... Не помогло, вот мой код. procedure TfmmRefEdit.UnimFormShow(Sender: TObject); begin Self.TitleButtons[0].Visible := false; UniSession.AddJS(Self.Name + '.titlebar.getAt(0).hide()'); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 20, 2021 Share Posted January 20, 2021 3 minutes ago, x11 said: Не помогло, вот мой код. Проанализируйте код пожалуйста: procedure TUnimForm1.UnimFormShow(Sender: TObject); var I: Byte; begin I := 1; //title "indx" if Self.CloseButton.Visible then Inc(I); //closebutton "indx" //for example, hide TitleButtons[0] UniSession.AddJS(Self.Name + '.titlebar.getAt('+ IntToStr(I) +').hide()'); //or .show() end; I := 1; //title "indx" if Self.CloseButton.Visible then Inc(I); //closebutton "indx" Quote Link to comment Share on other sites More sharing options...
x11 Posted January 20, 2021 Author Share Posted January 20, 2021 Не пойму. У меня скрывается кнопка Закрыть вместо кнопки Сохранить. procedure TitleButtonClose(form: TunimForm; btnIdx: Byte); Var i: byte; begin i := btnIdx; if form.CloseButton.Visible then Inc(i); //closebutton "indx" - будет закрыта кнопка с индексом 1 //for example, hide TitleButtons[0] UniSession.AddJS(form.Name + '.titlebar.getAt('+ IntToStr(i) +').hide()'); //or .show() end; //вызов процедуры TitleButtonClose(self, 0); Quote Link to comment Share on other sites More sharing options...
x11 Posted January 20, 2021 Author Share Posted January 20, 2021 Нужно скрыть кнопку с индексом 0 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 20, 2021 Share Posted January 20, 2021 I := 1; //title "indx" -> значение 1 - типа константа Дальше -> Если есть form.CloseButton, то переменная I теперь =2 3 minutes ago, x11 said: Нужно скрыть кнопку с индексом 0 0 -> 2 (используйте 2 вместо 0) Quote Link to comment Share on other sites More sharing options...
x11 Posted January 20, 2021 Author Share Posted January 20, 2021 Если кнопка с индексом 0, то закрывать нужно кнопку с индексом 2? так? procedure TitleButtonClose(form: TunimForm; btnIdx: Byte); Var i: byte; begin i := btnIdx; if form.CloseButton.Visible then Inc(i, 2); //closebutton "indx" //for example, hide TitleButtons[0] UniSession.AddJS(form.Name + '.titlebar.getAt('+ IntToStr(i) +').hide()'); //or .show() end; т.е. нужно Inc(i, 2); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 20, 2021 Share Posted January 20, 2021 4 minutes ago, x11 said: т.е. нужно Inc(i, 2); Да, вот корректный код: i := btnIdx; if form.CloseButton.Visible then Inc(i, 2); //closebutton "indx" else Inc(i, 1); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 20, 2021 Share Posted January 20, 2021 Еще проще... procedure TMainmForm.UnimFormShow(Sender: TObject); begin JSInterface.JSCall('hide', [], TitleButtons[0].JSMenuItem); 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.