I need to create a Window fills with button that i can click and the value of the caption/label will be update to a textfield or textarea.
I already create the Window and when this window is open, i want to use code to create few rows of button. How do i accomplish this?
To dynamically add controls to a window you’ll want to either use Control Sets or ContainerControls.
where in the language reference or guide where i can find the information??
what i want to do is open a table, find out how many item is there, then dynamically create a button, assign the value from the table and then move on to the next record and repeat.
User Guide Book 2: User Interface, Chapter 2: Desktop, Section 16: Control Sets and Dynamic Controls
In the Language Reference, ContainerControl.EmbedWithin shows how to add a ContainerControl to a window at run-time.
i got it working now. i define a property for pb as cmdChar which is my control set.
dim rs as RecordSet
dim x as Integer, y as integer
dim vSQL as string = "SELECT * FROM tblSpecialChars WHERE ShowYN=1 ORDER BY Sequence"
rs = DoDBOpenRS(vSQL)
if rs<>nil then
While Not rs.eof
x=x+1
pb = new cmdChar
pb.caption= rs.Field("Character").StringValue
SELECT CASE x
CASE 1 to 10
pb.top=10
IF x=1 then y=0
CASE 11 to 20
pb.top=50
IF x=11 then y=0
END SELECT
y=y+1
pb.left=40 * y
pb.visible=true
rs.MoveNext
Wend
rs.Close
END IF
cmdChar(0).Visible=false