Private Sub DisplayInstruction As ResumableSub
Dim Instruction As instructor_info=lstHints.Get(0)
lblHint.Text=Instruction.Instruction
SetHintContainerHeight
cvs.ClearRect(cvs.TargetRect) 'Clear the drawings
cvs.DrawRect(cvs.TargetRect,xui.Color_ARGB(BackgroundAlpha,0,0,0),True,0) 'dimm the background
'Determine if instruction panel should be positioned above or below the target view
Dim vTop As Int = Instruction.xView.Top
Dim xParentView As B4XView= Instruction.xView.Parent
Dim vTop2 As Int=0
If xParentView.IsInitialized Then
vTop2=xParentView.Top
vTop2=vTop2-NavHeight 'affects b4i only
vTop=vTop+vTop2
End If
If vTop2=0 Then
Dim vHalf As Int=Instruction.xView.Height/2
Dim bTopHalf As Boolean=vTop+vHalf<(ParentPanel.Height/2)
pnlHintContainer.Top=IIf(bTopHalf,Instruction.xView.Top+Instruction.xView.Height+40dip,Instruction.xView.Top-pnlHintContainer.Height-40dip)
Else 'VIEW IS INSIDE PARENT
Dim vHalf As Int=xParentView.Top+(Instruction.xView.Top+(Instruction.xView.Height/2))
Dim bTopHalf As Boolean=vHalf<(ParentPanel.Height/2)
pnlHintContainer.Top=IIf(bTopHalf, xParentView.Top+Instruction.xView.Top+Instruction.xView.Height+40dip,vTop-pnlHintContainer.Height-40dip)
End If
pnlHintContainer.Top=pnlHintContainer.Top+NavHeight 'affects b4i only
'Set the target highlighter size and postion
If vTop2=0 Then'REGULAR VIEW
pnlTargetHighlighter.SetLayoutAnimated(0,Instruction.xView.Left,xParentView.Top+Instruction.xView.Top,Instruction.xView.Width,Instruction.xView.Height)
Else'VIEW IS INSIDE PARENT
pnlTargetHighlighter.SetLayoutAnimated(0, xParentView.left+Instruction.xView.Left,xParentView.Top+Instruction.xView.Top,Instruction.xView.Width,Instruction.xView.Height)
pnlTargetHighlighter.Top=pnlTargetHighlighter.Top+NavHeight 'affects b4i only
End If
pnlTargetHighlighter.Visible=HighlightTargetView
If DisplayConnectorLine Then
'Get the connector line start/end points
Dim iSection As Int=GetViewQuadSection(Instruction.xView)
Dim xFromPoint As Int=pnlHintContainer.Left+GetLineStart(iSection)
Dim yFromPoint As Int=IIf(bTopHalf ,pnlHintContainer.Top+2dip, pnlHintContainer.Top+pnlHintContainer.Height-2dip)
Dim xToPoint As Int=pnlTargetHighlighter.Left+(pnlTargetHighlighter.Width/2)
Dim yToPoint As Int=IIf(bTopHalf, pnlTargetHighlighter.Top+pnlTargetHighlighter.Height-2dip, pnlTargetHighlighter.Top+2dip)
yFromPoint=yFromPoint+NavHeight'affects b4i only
yToPoint=yToPoint+NavHeight'affects b4i only
'Draw the connector line
If cvs.TargetView<>pnlCanvas Then cvs.Initialize(pnlCanvas)'b4i only - required after calling cvs.Release
' cvs.ClearRect(cvs.TargetRect)
cvs.DrawLine(xFromPoint, yFromPoint, xToPoint, yToPoint, OutlineColor, 3dip)
cvs.Invalidate
End If
'Display correct colors
Dim rect As B4XRect
rect.Initialize(pnlTargetHighlighter.Left+3dip,pnlTargetHighlighter.Top+3dip,pnlTargetHighlighter.Left+pnlTargetHighlighter.Width-3dip,pnlTargetHighlighter.Top+pnlTargetHighlighter.Height-3dip)
cvs.ClearRect(rect) 'cut out the Target
pnlHintContainer.SetColorAndBorder(CaptionColor,3dip,OutlineColor,8dip)
pnlTargetHighlighter.SetColorAndBorder(xui.Color_Transparent,3dip,OutlineColor,3dip)
pnlHintContainer.BringToFront
'Display the instruction text
lblHint.Text=Instruction.Instruction
lblHint.TextColor=TextColor
pnlBG.BringToFront
pnlTargetHighlighter.BringToFront
pnlBG.SetVisibleAnimated(200, True)
Return True
End Sub