little issue with FullScroll method in hsv

qsrtech

Active Member
Licensed User
Longtime User
I'm using the FullScroll method to scroll my horizontal panel but for some reason it doesn't work correctly. The weird thing is when I put a break on the line and step it, it works right.

here's my code:
B4X:
Sub AddTransaction(ATransaction As TTransaction)
    Transactions.Insertat(0,ATransaction)
   'resize our inner panel
   pnlTransaction.Panel.Width=(Transactions.Size)*pnlOrder.Width
   pnlTransaction.Panel.AddView(ATransaction.APanel,pnlOrder.Width*(Transactions.Size-1),0,pnlOrder.Width,pnlOrder.Height)'-Globals.RowHeight)
   ATransaction.APanel.Visible=True
   'scroll our panel all the way right
   pnlTransaction.FullScroll(True) 'put a break here and step then it works
   DoEvents '??? still doesn't work
End Sub

Any tips?
 

TheWind777

Active Member
Licensed User
Longtime User
Try this:
B4X:
pnlTransaction.FullScroll(True)
DoEvents
pnlTransaction.FullScroll(True)
DoEvents


Yep. That's what I just finished succeeding at. Found FullScroll, realized it would let me scroll to the end of the text, then I'd read the ScrollPosition, then I'd set it to the remembered scroll position and use the FullScroll value when I did my:

B4X:
Sub scvACIMChapter_ScrollChanged(Position AsInt)
' ...
End Sub

However, it took more fiddling than just two successive FullScroll(True) and DoEvents. I had to put an assignment between the two, and I forced the Focus first.

Then, the code for interpreting the beginning and end point also had to be fiddled-with.

B4X:
IfDoGlowThen

If Position < 20Then

ImageViewACIMTopGlow.Visible = False

Else

ImageViewACIMTopGlow.Visible = True

EndIf





If Position > (scvACIMFullScroll - 5) Then

ImageViewACIMBottomGlow.Visible = False

Else

ImageViewACIMBottomGlow.Visible = True

EndIf



IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMHeight = " & scvACIMHeight)

IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMTextHeight = " & scvACIMTextHeight)

IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMFullScroll = " & scvACIMFullScroll)

EndIf

So, I'm comparing whether it is CLOSE to 0, or CLOSE to the end.

And I'm checking for a digits bobble at the front-end.

It is seems extremely reliable. It isn't sometimes not getting the longest scroll wrong (sometimes it would = 0).

Anyways, thank you.

Sometimes even doing it twice doesn't give it enough time to actually do it.

The code at the front-end is like this:

B4X:
Sub scvACIMChapter_ScrollChanged(Position AsInt)

Dim NewPosition AsInt



IfDoScrollPosThen

IfPGDebugging4ThenLog(" +++ Begin of scvACIMChapter_ScrollChanged()")

NewPosition = scvACIMChapter.ScrollPosition



If NewPosition <> Position Then

IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - Position NOT SAME")

Position = NewPosition

EndIf





IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - Position = " & Position)

SaveACIMScrollPos(Position, FigureACIMNumber(""))



IfDoGlowThen

If Position < 20Then

ImageViewACIMTopGlow.Visible = False

Else

ImageViewACIMTopGlow.Visible = True

EndIf





If Position > (scvACIMFullScroll - 5) Then

ImageViewACIMBottomGlow.Visible = False

Else

ImageViewACIMBottomGlow.Visible = True

EndIf



IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMHeight = " & scvACIMHeight)

IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMTextHeight = " & scvACIMTextHeight)

IfPGDebugging4ThenLog("scvACIMChapter_ScrollChanged() - scvACIMFullScroll = " & scvACIMFullScroll)

EndIf



DoEvents

IfPGDebugging4ThenLog(" --- End of scvACIMChapter_ScrollChanged()")

IfPGDebugging4ThenLog(" ")

EndIf

End Sub
 
Upvote 0
Top