m.rabatscher

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: How to show progressbar in form-titlebar? #70930
    m.rabatscher
    Participant

      @ alpha skin team:
      this option above works fine BUT! :

      In some circumstances the code above leads to a stack overflow
      -> if some caches are not ready yet the WM_PAINT call triggers a full repaint?!?! which again triggres
      this event handler to be called again.

      So basically the code needs to be modified as:

      procedure TfrmDarwin.sDarwinTitleBarItems1DrawItem(Item: TacTitleBarItem;
        ADrawData: TacTitleItemDrawData);
      const cTopOffset = 2;
      begin
           if not fInTitleDrawing and (geProgress.Progress > 0) then
           begin
                // ###########################################
                // #### Now paint the hidden progress bar to the titel bar
      
                // the Perform(WM_PAINT,...) method can atually cause a stack overflow in case the timing is bad and the components cache has not yet been
                // created before the title bar is drawn. This should not happen though in the component and is just a hack to avoid the stack problem.
      
                // basically start the darwin with bad sema connection params and see the overflow happen
                fInTitleDrawing := True;
                try
                   ADrawData.Bmp.Canvas.Lock;
                   OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, aDrawData.ARect.Left, aDrawData.ARect.Top + cTopOffset, nil );
                   geProgress.Perform(WM_PAINT, WPARAM(ADrawData.Bmp.Canvas.Handle), 0);
                   OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, -aDrawData.ARect.Left, -aDrawData.ARect.Top - cTopOffset, nil );
                   ADrawData.Bmp.Canvas.Unlock;
                finally
                       fInTitleDrawing := False;
                end;
           end;
      end;

      Note: fInTitleDrawing is a member variable of the form

      • This reply was modified 3 years, 8 months ago by m.rabatscher.
      in reply to: Embedding forms in a panel #70873
      m.rabatscher
      Participant

        I actually rewrote my approach such that I now use the TsPageControl.
        On the first tab we have the standard form’s elements and on the second one I attach the second form
        via the parent property. The form now has bsNone border style and the skin section used is ‘TRANSPARENT’ (used in the routine above).

        It looks now quite nice but there is an invisible margin of a few pixels which I don’t know where that one can
        come from. I already removed any margin values from the forms/tabs/pagecontrol but still there is a margin when on the main form and the database view tab.

        Is there anything I can do?

        in reply to: Embedding forms in a panel #70865
        m.rabatscher
        Participant

          I actually have a solution but I’m not quite sure if it’s the right one:

          procedure TForm1.sSkinProvider1SkinItemEx(Item: TComponent;
          var CanBeAdded: Boolean; SkinParams: PacSkinParams);
          begin
          CanBeAdded := True;

          // tfrmdbbrowser is the form to be embedded
          if (item is TfrmDBBrowser) then
          SkinParams^.SkinSection := ‘PANEL’;
          end;

          this reduces the border to a minimum.
          Is there another thing I can try?

        Viewing 3 posts - 1 through 3 (of 3 total)