Jump to content

Why TUniImage.Visible does not work always?


eelias

Recommended Posts

Hi there!

 

I am having a strange behavior, I have created a new component that is similar to UNIDBNAVIGATOR.

 

I used the concept of compound components, then I have a TUniFrame as the base and created TUniImages as the buttons.

 

I wanted to have Flat Images, so the TUniImage works for that, and responds to the OnClick event.

 

Everything fine here,

 

I have placed those TUniImage on my TUniFrame and assigneded the OnClick:

  uiCancel.OnClick   := OnDBCommandClick;
  uiRefresh.OnClick  := OnDBCommandClick;
  uiPost.OnClick     := OnDBCommandClick;
  uiDelete.OnClick   := OnDBCommandClick;
  uiInsert.OnClick   := OnDBCommandClick;
  uiNext.OnClick     := OnDBCommandClick;
  uiPrevious.OnClick := OnDBCommandClick;

Based on that I receive the command and change my DataSource just fine.

 

However I dont want to have those "buttons" enabled always, for that:

procedure TNaharWebDBNavigator.UpdateButtonsState;
begin
  if Not Assigned(FDataSource) then
    exit;

  if not Assigned(FDataSource.DataSet) then
    exit;

  case FDataSource.DataSet.State of
    dsInactive :
      begin
        uiPrevious.Visible  := false;
        uiNext.Visible      := false;
        uiInsert.Visible    := false;
        uiDelete.Visible    := false;
        uiPost.Visible      := false;
        uiRefresh.Visible   := false;
        uiCancel.Visible    := false;
      end;
    dsBrowse :
      begin
        uiPrevious.Visible  := true;
        uiNext.Visible      := true;
        uiInsert.Visible    := true;
        uiDelete.Visible    := true;
        uiPost.Visible      := false;
        uiRefresh.Visible   := true;
        uiCancel.Visible    := false;
      end;
    dsInsert, dsEdit :
      begin
        uiPrevious.Visible  := false;
        uiNext.Visible      := false;
        uiInsert.Visible    := false;
        uiDelete.Visible    := false;
        uiPost.Visible      := true;
        uiRefresh.Visible   := false;
        uiCancel.Visible    := true;
      end;
    else
    begin
      uiPrevious.Visible  := false;
      uiNext.Visible      := false;
      uiInsert.Visible    := false;
      uiDelete.Visible    := false;
      uiPost.Visible      := false;
      uiRefresh.Visible   := false;
      uiCancel.Visible    := false;
    end;
  end;

end;

Testing it, it does now works correctly, the buttons (TUniImage) do not get hide or visible correctly. 

 

My component keep all of them visible for the first time, and in Loaded update the status.

 

I see it changing the visible on the first time correctly. But after that there is not way to work correctly. The visible property is changed on the program but it is not reflected on the extjs side.

 

Is there a way to force an update of the properties from the delphi side to extjs?

 

Or, what is wrong?

 

Eduardo

 

 

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...