Jump to content

UniShowCase - which components to use?


elGringo
 Share

Recommended Posts

Ok, i have done this simple task but i have problem with scroll box... How it works? Can't understand.

 

I add ProductFrames like that

 

uUniShowCaseFrame

procedure TUniShowCaseFrame.AddProductFrame;
var i:integer;
      Product:TProductFrame;

begin

  i:=FProductsOL.Add( TProductFrame.Create(Self) );


  with TProductFrame(FProductsOL[i]) do begin

  Parent:=Self;

  Inc(FNameCount);
  Name:='SomeName'+FNameCount.ToString;

  //In which row to put? In current or next?

   if i>0 then
     begin
       if TProductFrame(FProductsOL[i-1]).Left+
       2*TProductFrame(FProductsOL[i-1]).width>FMaxWidth then

        begin
        Top:=TProductFrame(FProductsOL[i-1]).Top+
        TProductFrame(FProductsOL[i-1]).Height;
        Left:=0;

        Self.Height:=Self.Height+TProductFrame(FProductsOL[i-1]).Height;
        end else

        begin

        Top:=TProductFrame(FProductsOL[i-1]).Top;
        Left:=TProductFrame(FProductsOL[i-1]).Left+
        TProductFrame(FProductsOL[i-1]).width;

        end;



     end;



  end;


end;

I put UniShowCaseFrame on the ScrollBox in MainForm

procedure TMainForm.UniFormCreate(Sender: TObject);
begin

FUniShowCaseFrame:=TUniShowCaseFrame.Create(Self);
FUniShowCaseFrame.Parent:=UniScrollBox;// Self;
FUniShowCaseFrame.Align:=alClient;
FUniShowCaseFrame.MaxWidth:=Self.Width;


end;

and it does not work... when summary productFrames height is more than ScrollBars height no VerticalScroll Bar appears

 

 

post-2378-0-91298400-1481021258_thumb.jpg

Link to comment
Share on other sites

And how to repaint frame? I paint border on each frame like that on Create

procedure TProductFrame.PaintBorder;
begin
  UniCanvas.BitmapCanvas.Pen.Color := $A4A0A0;
  UniCanvas.BitmapCanvas.MoveTo(5, 5);
  UniCanvas.BitmapCanvas.LineTo(5, (UniCanvas.Height - 5));
  UniCanvas.BitmapCanvas.MoveTo(5, 5);
  UniCanvas.BitmapCanvas.LineTo(UniCanvas.width - 5, 5);
  UniCanvas.BitmapCanvas.MoveTo(UniCanvas.width - 5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.LineTo(5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.MoveTo(UniCanvas.width - 5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.LineTo(UniCanvas.width - 5, 5);
end;

procedure TProductFrame.UniFrameCreate(Sender: TObject);
begin

//

CenterElements;

PaintBorder;  // <<<

UniImageList.GetBitmap(0,Image.Picture.Bitmap);

end;

But when I create frame no border painted, when I create another one - previous frame has border and so on - see picture

 

I think there sould be way to repaint border

 

 

post-2378-0-82763100-1481024039_thumb.jpg

Link to comment
Share on other sites

Hi,

 

For now try this:

uses ... UniGUIJSInterface;
procedure TProductFrame.PaintBorder;
begin
  UniCanvas.BitmapCanvas.Pen.Color := $A4A0A0;
  UniCanvas.BitmapCanvas.MoveTo(5, 5);
  UniCanvas.BitmapCanvas.LineTo(5, (UniCanvas.Height - 5));
  UniCanvas.BitmapCanvas.MoveTo(5, 5);
  UniCanvas.BitmapCanvas.LineTo(UniCanvas.width - 5, 5);
  UniCanvas.BitmapCanvas.MoveTo(UniCanvas.width - 5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.LineTo(5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.MoveTo(UniCanvas.width - 5, UniCanvas.Height - 5);
  UniCanvas.BitmapCanvas.LineTo(UniCanvas.width - 5, 5);
  IUniJSInterface(UniCanvas).JSCall('submitData', []);         // <----------------
end;

But, better try to use the style of the border of the panel

 

Best regards.

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.

 Share

×
×
  • Create New...