Starting to program using both languages (3rd part )
This is a good opportunity to clarify to myself also the ideas i am trying. Starting to program.1
To do this i shall detail herewith how develop a real code's segment of Starting to program.2
an application.The code previously quoted allow you to use on NSbasic also the objects'
array but using this type of objects in Visual Basic not only you get an
index to recall and add code to any object created but allows you also to
modify dimensions and position of each object.
The current code segment does not allow these performances.
If we wish therefore get this ability we have to modify our code as follows
to create our second objects'array:
Dim Blabel(4)
Dim PosLab,PosLbl,x,p,z, y
Dim L,T,W,H
y=0
PosLab="70,84,50,18|70,104,100,18|70,124,125,18|70,144,50,18|70,164,150,18"
I=0
Do While Len(PosLab)
z=Instr(PosLab + "|","|")
PosLbl=Left(PosLab,z-1)
x=0
Do While Len(PosLbl)
p=Instr(PosLbl + ",",",")
If x=0 Then L=Left(PosLbl,p-1)
If x=1 Then T=Left(PosLbl,p-1)
If x=2 Then W=Left(PosLbl,p-1)
If x=3 Then H=Left(PosLbl,p-1)
PosLbl=Mid(PosLbl,p+1):x=x+1
Loop
ADDOBJECT "Label","Blabel" & y ,L,T,W,H
EXECUTE("SET Blabel(" & y & ") = Blabel" & y)
EXECUTE("SUB Blabel"& y &"_Click" _
& vbCrLf & "Blabel_Click("& y &")" _
& vbCrLf &"END SUB")
Blabel( y ).FontBold = True
Blabel( y ).BorderStyle=1
Blabel( y ).Caption=""
PosLab = Mid(PosLab, z + 1):y=y+1
Loop
The above code will create for you an array of Labels for which you can
can change the single dimensions and position simply changing the value
in the "PosLab" string. (you may use obviously others objects also)
(this code will be authomatically created by the Vers.2 of NSassist soonest).
You now have two forms (VB and NSbasicCE) that allow you to use the
same standard code on both the system enabling you to write a common
program with few further adjustments.
If you do not like to copy the code the full code text file is HERE<<< Tips Index