Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simply a beginner

Status
Not open for further replies.

xor402

Programmer
Aug 7, 2010
3
EG
Hi,

i just started learning powerbuilder on my own, so i need to learn the basics , creating a control on a form is ok, but i am facing trouble with the scripts, i have this singlelineedit control, where the user input an integer value, how i assign an integer variable to this control, since "i guess" the control accepts text only, a mismatch will happen, am i right.

I appreciate your help.
 
Thanks mbalent for your reply

But, i asked how to assign an integer " variable " not value.

Meaning i have an integer variable call it intX

Simply if i wrote

intX = sle.text

this will cause the application to make an error because it cannot assign an integer variable to a string "text entered in the control "

How can i do it?
 
intX = integer(sle.text)

However, remember that integers in Powerbuilder range from -32768 to +32767. Also, unless you have code to interpret the value in sle.text for non numerics you will get 0. You can use the IsNumber method to check if the text is numeric.

Matt

"Nature forges everything on the anvil of time"
 
Thanks again mbalent for your great help

Since i am a beginner, could you recommend a book or any tutorial for basic powerbuilder learning.

I have made many changes on my script because integer wasn't working with me, so i chose decimal and i used dec to convert the entered text into decimal.

Now i have a new problem i need to chose that when a radio button is clicked the result changes rdb_1, rdb_2

How can i do this?

Thanks again for your help

 
Hi,

I would also consider using a datawindow with an external datasource to create the controls rather than the singlelineedit, radiobutton etc controls on the window.

In the DW you can then choose an edit style type of radio button, edit, dropdown etc for each control

If you do it this way you can then use getitemstring, getitemnumber etc and setItem methods.

e.g. for your scenario of needing to assign a variable to an edit control, if it was on a datawindow...

dw_name.setItem( 1, "edit_control_name", li_variable_name )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top