Keep a TPanel fixed

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Keep a TPanel fixed

Postby mark_c » Sun Apr 05, 2020 1:08 pm

I created a TForm, added a TPanel and a TImage dynamically. When the image is larger than the TForm, the scroll bars appear. My problem is that the TPanel also moves with the TImage but I would like it to remain fixed.

Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
        TForm *MyForm = new TForm(this);
        MyForm->Visible=true;
        MyForm->HorzScrollBar->Visible=true;
        MyForm->VertScrollBar->Visible=true;
        MyForm->Width=1000;
        MyForm->Height=500;

        TPanel *MyPanel = new TPanel(MyForm);
        MyPanel->Parent=MyForm;
        MyPanel->Align=alTop;
        MyPanel->Height=40;

        TImage *Image1 = new TImage(MyForm);
        Image1->Parent=MyForm;
        Image1->Left=0;
        Image1->Top=40;

        Image1->Picture->Bitmap->LoadFromFile("mypicture.bmp");
        Image1->Picture->Bitmap->Width=12000;
        Image1->Picture->Bitmap->Height=2124;
        Image1->Width=12000;
        Image1->Height=2124;



        MyForm->VertScrollBar->Position=900;       
}
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby mark_c » Mon Apr 06, 2020 1:09 am

after many settings I am convinced that it is not possible to block the TPanel which continues to scroll together with the TImage.
How is it possible that there is no way to anchor the TPanel to the title bar so that the TImage flows under the TPanel?
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby mark_c » Mon Apr 06, 2020 1:48 am

sorry but I solved it myself using the ScrollBox component that I had never used: there is always a first time.

Thanks anyway.
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby mark_c » Mon Apr 06, 2020 6:00 am

nothing has changed, I caught a crab.
I want the TPanel to scroll horizontally but remain anchored to the title bar, as if it were a ruler.
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby HsiaLin » Tue Apr 07, 2020 10:15 am

Set panels Align property to alTop.
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 326
Joined: Sun Jul 08, 2007 6:29 pm

Re: Keep a TPanel fixed

Postby mark_c » Tue Apr 07, 2020 11:48 am

thanks, but I've already tried that way

look at the Score View of this screen https://ibb.co/c88DnGr the ruler remains stationary and the staff can freely scroll to the right and down
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby HsiaLin » Wed Apr 08, 2020 6:39 pm

That an MDI application it looks like. Multiple document interface.
Last edited by HsiaLin on Wed Apr 08, 2020 7:47 pm, edited 1 time in total.
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 326
Joined: Sun Jul 08, 2007 6:29 pm

Re: Keep a TPanel fixed

Postby HsiaLin » Wed Apr 08, 2020 7:24 pm

I`m not really sure what you are trying to do but maybe this will help.
If not then i don't know what to tell you.
Attachments
markscrolltest.rar
(187.95 KiB) Downloaded 580 times
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 326
Joined: Sun Jul 08, 2007 6:29 pm

Re: Keep a TPanel fixed

Postby mark_c » Thu Apr 09, 2020 5:26 am

thanks for trying, the way is that.
However, if you look well, the image must remain fixed to the left and the "page" must scroll below the image. If you look at the image I posted, the piano keyboard remains fixed while the score scrolls below.
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am

Re: Keep a TPanel fixed

Postby HsiaLin » Thu Apr 09, 2020 8:46 am

I was only making the scrolling part for you, you could add another panel to the bottom and put pictures onto it that will not scroll, like the piano is. That whole application in the picture is custom made, you`ll have to do the same with ingenuity.
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 326
Joined: Sun Jul 08, 2007 6:29 pm

Re: Keep a TPanel fixed

Postby mark_c » Thu Apr 09, 2020 9:56 am

you're right, I can solve the problem with a second panel on the left.

Thanks
mark_c
BCBJ Master
BCBJ Master
 
Posts: 243
Joined: Thu Jun 21, 2012 1:13 am


Return to Technical

Who is online

Users browsing this forum: No registered users and 25 guests