Dear support,
I don't know how I can coded this part of code written in Visual Basic 6 into PowerBasic.
Maybe someone help me with this problem
This is the VB6 code:
U = (U - HScroll1.Value) / HScroll2.Value * 10
Very difficult for me.
I try it so in PowerBasic
LOCAL temp1 AS LONG
LOCAL temp2 AS LONG
LOCAL U AS DOUBLE
'==============================================================
'First : I read the position of the schrollbar and save them in a temporary variable
'==============================================================
SCROLLBAR GET POS CB.HNDL, %IDC_HSCROLL1 TO temp1
SCROLLBAR GET POS CB.HNDL, %IDC_HSCROLL2 TO temp2
'==============================================================
'Second : Calculate the positions of scrollbar 1 and 2
'==============================================================
temp1 = (U - temp1)
temp2 = (temp2 * 10)
'==============================================================
'Thrith : The two new values stores in variables pos1 and pos2
'==============================================================
' Here is the problem
'SCROLLBAR SET POS CB.HNDL, %IDC_HSCROLL1, pos1
'SCROLLBAR SET POS CB.HNDL, %IDC_HSCROLL2, pos2
U = CDBL(temp1 / temp2)
How can devided the two positions of the schrollbar????
Please can somebody help me I have this needed from my project for education.
Thanks
Stephane
Quotetemp1 = (U - temp1)
You have not assigned a value to U before using it, thus you're working with 0 …
Let’s say your scrollers are at position 5 and 8, giving you this rundown with the “VB6 calculationâ€;
U = (U - HScroll1.Value) / HScroll2.Value * 10
U = (0â€"
5) /
8*10
U = -5 / 8*10
U = -0,625*10
U = -6.25