Jump to content

TitleButtons мобильной формы не обращает внимание на TAction


x11

Recommended Posts

У формы есть встроенные кнопки (TitleButtons), которые привязаны к TAction.

В событии onShow я что-то проверяю и выполняется строка

actPhoneAdd.Visible := false;

При этом кнопка формы, которая привязана к этому действию, всё равно остается видимой. По идее, кнопка должна тоже поменять свое значение видимости.

Мало того, когда я принудительно прячу кнопку

self.TitleButtons[0].Visible := false;

кнопка всё равно видна

 

Screenshot_4.jpg

Link to comment
Share on other sites

Похожая проблема у ToolButtons только уже в дизайне.

У панели есть кнопки в заголовке. Выбираю у кнопки Action, и заполняется только ImageIndex, а свойство Hint остается пустым.

Screenshot_24.jpg

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

И это еще не все.

Кнопка не скрывается в событии UnimFormShow.

Проверяю отладчиком, строка выполняется

Self.TitleButtons[0].Visible := false;

 

Screenshot_46.jpg

Screenshot_45.jpg

Link to comment
Share on other sites

27 minutes ago, x11 said:

Кнопка не скрывается в событии UnimFormShow.

Проверяю отладчиком, строка выполняется

Пока попробуйте использовать это решение...

 

  • Like 1
Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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"

 

Link to comment
Share on other sites

Не пойму.

У меня скрывается кнопка Закрыть вместо кнопки Сохранить.
 

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);

 

Link to comment
Share on other sites

I := 1; //title "indx" -> значение 1 - типа константа

Дальше -> Если есть form.CloseButton, то переменная I теперь =2

3 minutes ago, x11 said:

Нужно скрыть кнопку с индексом 0

0 -> 2 (используйте 2 вместо 0)

Link to comment
Share on other sites

Если кнопка с индексом 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);

Screenshot_2.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...