Subscribe Bookmark RSS Feed

Keeping a Button at the Top (or Left)

msharp

Super User

Joined:

Jul 28, 2015

Hey guys, I have a display window where I want to keep a "Run" button at the top.  The display can be several screen sizes in length, but I want the run button to stay at the top so a user can easily access key buttons no matter how far they have scrolled.

I have considered using a Scroll Box(), but having a window that scrolls and a box that scrolls can always be user un-friendly.   I think a VSheetBox might also do the trick, but haven't had a chance to look into it.  Any tips or other suggestions on how to accomplish this?

7 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

I would suggest using a border box.  This script has the sides of the border box displayed, so you can see it in relationship to the button box, but they can be turned off.

Names Default To Here( 1 );

New Window( "test",

                Button Box( "at top" ),

                Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),

                                V List Box( Spacer Box( size( 1, 30 ) ), Text Box( "text" ), Spacer Box( size( 1, 30 ) ), Text Box( "second text" ) )

                )

);


11684_pastedImage_2.png


Jim
msharp

Super User

Joined:

Jul 28, 2015

This doesn't appear to be a solution, adding some more text boxes, collapsing the window and scrolling down, shows that indeed, the button doesn't stay at the top.  It needs to stay at the top ALWAYS.  Meaning, it needs to always be displayed.

As you can see, I can manipulate the window in such a way that the button isn't displayed.

11686_pastedImage_0.png

txnelson

Super User

Joined:

Jun 22, 2012

Your observation is correct.......You can change the border box to a scroll box, but that will have an issue too, once the window size is smaller than the scroll box.

Jim
pmroz

Super User

Joined:

Jun 23, 2011

FWIW this will scroll and leave the button at the top, but requires the use of a tablebox.  If you figure out how to do it for things other than a tablebox please share! 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "Example", button box("Test Button"),

tbox = Data Table Box( dt ) );

tbox << set scrollable(10, 0);

ian_jmp

Staff

Joined:

Jun 23, 2011

Not a button as such, but here's a plausible alternative:

Names Default To Here( 1 );

New Window( "Example",

Outline Box( "Commands",

{"Action 1", Beep(), "Action 2", Beep();Wait(0.1);Beep()},

Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),

V List Box(

Spacer Box( size( 1, 30 ) ),

Text Box( "text" ),

Spacer Box( size( 1, 30 ) ),

Text Box( "second text" ),

Spacer Box( size( 1, 30 ) ),

Text Box( "text" ),

Spacer Box( size( 1, 30 ) ),

Text Box( "second text" ),

Spacer Box( size( 1, 30 ) ),

Text Box( "text" ),

Spacer Box( size( 1, 30 ) ),

Text Box( "second text" )

)

)

)

);

pmroz

Super User

Joined:

Jun 23, 2011

I found  v scroll box  which for some reason is not in the scripting index under display boxes.  It's under functions

New Window( "Example", button box("Test Button"),

      v scroll box(size(100), flexible(1),

            vlistbox(

                  textbox("First long text"),

                  textbox("Second"),

                  textbox("Third"),

                  textbox("Fourth"),

                  textbox("Fifth"),

                  textbox("Sixth"),

                  textbox("Seventh"),

                  textbox("Eigth"),

                  textbox("Ninth"),

                  textbox("Tenth"),

                  button box("Bottom")

            )

      )

);

msharp

Super User

Joined:

Jul 28, 2015

Thanks guys, reading your thoughts helped get me on the right track.  I ended up combining a vsheetbox and vscrollbox.  In unison you get a clean interface that overcomes the deficiencies in using just one or the other.

New Window( "Example", button box("Test Button"),

      v sheet box(

            scrollbox(flexible(1),

                           vlistbox(

                  textbox("First long text"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Second"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Third"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Fourth"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Fifth"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Sixth"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Seventh"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Eigth"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Ninth"),

                  Spacer Box( size( 1, 30 ) ),

                  textbox("Tenth"),

                  Spacer Box( size( 1, 30 ) ),

                  button box("Bottom")

                )

            )

      )

);