How to scroll prompts horizontally?
Posted: Tue Oct 26, 2021 12:37 am
Hi,
Note: this isn't referring to a grid. I'm just doing some @row, @col Prompt statements.
Specifically, using Grumpfish's Menuh (below), I'm trying to figure out how to scroll the prompts to the right, when the prompts get past the maxcol() on the screen.
This is the Menuh.prg snippet that displays the prompts, from a list of prompts & messages separated by a dollar sign $.
This is my code that calls MenuH
I'm adapting it to Harbour of course, and surprisingly it doesn't require the Grump library.
In the attached images, there are Ten Prompts total.
The Ninth Prompt - mostly - fits on the screen, with just a few characters off to the right.
But the Tenth Prompt is all the way past the MaxCol(). Note that the Message corresponding to the Prompt, does fit on the screen, because it's justified to the Left.
How do we use Scroll() or another function to shift the prompts to the left, so that the Tenth Prompt is visible, while the first Prompt is not visible?
I played with Scroll() a bit, but it's having no effect.
Note: this isn't referring to a grid. I'm just doing some @row, @col Prompt statements.
Specifically, using Grumpfish's Menuh (below), I'm trying to figure out how to scroll the prompts to the right, when the prompts get past the maxcol() on the screen.
This is the Menuh.prg snippet that displays the prompts, from a list of prompts & messages separated by a dollar sign $.
Code: Select all
if '$' $ cPrompts
cPrompts := trim(cPrompts)
cPrompts := cPrompts + ;
if(substr(cPrompts, len(cPrompts), 1) == '$', '', '$')
do while ptr1 < len(cPrompts)
cPrompt := NextItem(cPrompts)
@ nRow, nCol prompt cPrompt message NextItem(cMessages)
cPrompts := Truncate(cPrompts)
cMessages := Truncate(cMessages)
nCol += len(cPrompt) + nSpacing
enddo
#ifdef MOUSE
menu to nChoice initial nChoice
#else
menu to nChoice
#endif
endifCode: Select all
Function HorzMenu
// SET WRAP ON
// SET MESSAGE TO 2 CENTER
SET MESSAGE TO 2
SETCOLOR( "W+/B,B/W,,W+/B")
cls(23, chr(177))
sel = MENUH(1, 0, 1, 'Data Entry$Reports$Previous Menu$Analysis$Fifth Selection$Sixth Selection$Seventh Selection$Eight Selection$Ninth Selection$Tenth Selection$','Data Entry starts here$Test the Report Writer$Go to the Previous Menu$Do some Analysis$Fifth Selection$Sixth Selection$Seventh Selection$Eight Selection$Ninth Selection$Tenth Selection$','W+/B,B/W,,W+/B')
DO CASE
CASE sel = 1
QOut( "Number 1 selected" )
wait
CASE sel = 2
QOut( "Number 2 selected" )
wait
CASE sel = 3
QOut( "Number 3 selected" )
wait
CASE sel = 4
QOut( "Number 4 selected" )
wait
CASE sel = 5
QOut( "Number 5 selected" )
wait
CASE sel = 6
QOut( "Number 6 selected" )
wait
CASE sel = 7
QOut( "Number 7 selected" )
wait
CASE sel = 8
QOut( "Number 8 selected" )
wait
CASE sel = 9
QOut( "Number 9 selected" )
wait
CASE sel = 10
QOut( "Number 10 selected" )
wait
OTHERWISE
RETURN
ENDCASE
Return Nil
I'm adapting it to Harbour of course, and surprisingly it doesn't require the Grump library.
In the attached images, there are Ten Prompts total.
The Ninth Prompt - mostly - fits on the screen, with just a few characters off to the right.
But the Tenth Prompt is all the way past the MaxCol(). Note that the Message corresponding to the Prompt, does fit on the screen, because it's justified to the Left.
How do we use Scroll() or another function to shift the prompts to the left, so that the Tenth Prompt is visible, while the first Prompt is not visible?
I played with Scroll() a bit, but it's having no effect.