Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data type conversion
#1
Problem description:

I have two edit/combo box fields in the User Interface i want to retrieve the value from these two fields and add it.


iam using the accessible command to get the value from the edit/combo box fields....

eg:
str stepsize1 stepsize2
Acc a1=acc(FRAME_STEP_SIZE FIELD_FRAME (win(NORTHWIND_TITLE "" "" 0x202)) WINDOW_CLASS "" 0x1001 0 0 "c14")
Acc a2=acc(FRAME_STEP_SIZE FIELD_FRAME (win(NORTHWIND_TITLE "" "" 0x202)) WINDOW_CLASS "" 0x1001 0 0 "c13")

stepsize1.getwintext(child(a1.a))
stepsize2.getwintext(child(a2.a))

since both stepsize1 and stepsize2 are string varaible i am not able to add it...

can i retrieve the edit/combo box value as integer....?


ultimately i want to retrive the values in the two edit field and add it.... can anyone help me....


thanks,
nithin
#2
To convert string to numeric, use function val. To convert numeric to str, simply use =.

stepsize1=a1.Name
stepsize2=a2.Name
int sum=val(stepzize1)+val(stepsize2)
#3
This works fine for integers if iam having a decimal value in the edit/combo box field
then addition operation fails....
how to take care of decimal values in addition...
#4
str s
double d
;...
s.findreplace(",") ;;remove thousand separators
d=val(s 2)


Forum Jump:


Users browsing this thread: 1 Guest(s)