Help in Graphics

i want to move the dot according to particular value specified in the textfield.

and what have you tried?
what has failed? what specifically about the thing you tried and have failed did you not understand the reason for?
have your read the users manuals and lang ref in regards to canvas, picture and other graphic functions?

yes i read them, but i want to enter specific value in the textfield and according to that i want to move the dot and graphics i have draw.
i have taken a textfield and now i want to convert the input value i.e. string into number and then according to that change the position of dot.$FromText$FromText

but Michel. he said he READ the documents :slight_smile:


yes i m already reading this val method ,but i want an example for this

Ganesh… this is not a classroom (sorry to be harsh)… its up to you to learn.
This volunteer group (none of us are paid, and most of us are not associated with Xojo as a company) will point out mistakes you make, or things you don’t understand… but it is up to you to TRY…

Personally, I would say this is the most simple thing to do, take a user input, and draw a dot on the screen.
I could send you a fully functional example in under 5 minutes, but what would that accomplish? You would not have learned much.

So ask specific questions about specific topics…

Assuming TextField1 has values specified as “5,120” and the dot is drawn in Canvas1, then something like this…


dim sa() As String = TextField1.Text.Split(",")

dim x, y As integer

if sa.Ubound >= 0 then x = Val(sa(0))
if sa.Ubound >= 1 then y = Val(sa(1))

g.ForeColor = &c000000
g.FillOval( x, y, 10, 10 )[/code]

bear in mind Will’s example contains no error checking, so it could fail if you do not enter numbers, or you do not enter two numbers with a comma, or the numbers exceed the size of the canvas

It won’t fail in the sense of a crash. Ubound is checked so no OutOfBounds exception, missing or non-number values are left as 0, and drawing outside the Canvas is fine.