1. Radio Buttons

Hey guys,

Thanks for the great forum.  I have a problem that I have been working on 
and cannot find the answer.  I would appreciate any and all help.  Thanks.

Below is a small program that I have written to try to solve the problem 
that I am having.  If you take a look at the program you will see a series 
of 5 rows.  Each row has 3 radio buttons and an edit box for a number.  With 
this program I would like to be able to select 1 radio button per row. This 
program will only allow 1 radio button per page.  If the user selects the 
left radio button I would like for it to multiply the value entered in the 
edit box time 1.  If the user selects the middle radio button I would like 
for it to multiply the value entered in the edit box times 2.  If the user 
selects the right radio button I would like for it to multiply the value 
entered in the edit box times 3.  Then display the answer in the total box 
at the bottom.

Thanks again,

Clay



------------------------------------------

include win32lib.ew

with trace
without warning


global constant

panelwin = create( Window, "Load", 0, Default, Default, 230, 320, 0 ),

abtitle9 = create( LText, "Value", panelwin, 86, 10, 50, 40, 0 ),
x = create( EditText, "", panelwin, 85, 38, 50, 20, 0 ),
y = create( EditText, "", panelwin, 85, 66, 50, 20, 0 ),
z = create( EditText, "", panelwin, 85, 96, 50, 20, 0 ),
xx = create( EditText, "", panelwin, 85, 126, 50, 20, 0 ),
yy = create( EditText, "", panelwin, 85, 156, 50, 20, 0 ),

title1 = create( LText, "  1", panelwin, 1, 5, 20, 30, 0 ),
title2 = create( LText, "  2", panelwin, 26, 5, 20, 30, 0 ),
title3 = create( LText, "  3", panelwin, 51, 5, 20, 30, 0 ),

a  = create( Radio, "", panelwin, 5, 40, 15, 10, 0 ),
b  = create( Radio, "", panelwin, 30, 40, 15, 10, 0 ),
c  = create( Radio, "1", panelwin, 55, 40, 23, 10, 0 ),
d  = create( Radio, "", panelwin, 5, 68, 15, 10, 0 ),
e  = create( Radio, "", panelwin, 30, 68, 15, 10, 0 ),
f  = create( Radio, "2", panelwin, 55, 68, 23, 10, 0 ),
g  = create( Radio, "", panelwin, 5, 98, 15, 10, 0 ),
h  = create( Radio, "", panelwin, 30, 98, 15, 10, 0 ),
i  = create( Radio, "3", panelwin, 55, 98, 23, 10, 0 ),
j  = create( Radio, "", panelwin, 5, 128, 15, 10, 0 ),
k  = create( Radio, "", panelwin, 30, 128, 15, 10, 0 ),
l  = create( Radio, "4", panelwin, 55, 128, 23, 10, 0 ),
m  = create( Radio, "", panelwin, 5, 158, 15, 10, 0 ),
n  = create( Radio, "", panelwin, 30, 158, 15, 10, 0 ),
o  = create( Radio, "5", panelwin, 55, 158, 23, 10, 0 ),

total = create( LText, "Total", panelwin, 1, 185, 100, 30, 0 ),
output = create( EditText, "", panelwin, 85, 185, 50, 20, 0 ),
line1 = create( LText, "----------------------------------------", panelwin, 
0, 175, 300, 10, 0 ),
line2 = create( LText, "----------------------------", panelwin, 100, 175, 
300, 10, 0 ),
cal = create( PushButton, "Calculate", panelwin, 10, 230, 60, 30, 0 )





procedure onClick_cal()


  atom one, two, three, four, five, totall

  one = getNumber( x )
  two = getNumber( y )
  three = getNumber( z )
  four = getNumber( xx )
  five = getNumber( yy )



  totall = (one+two+three+four+five)

  setText( output, sprintf("%8.2f",totall))

end procedure


onClick[ cal ] = routine_id("onClick_cal")

WinMain( panelwin, Normal )

new topic     » topic index » view message » categorize

2. Re: Radio Buttons

On Sun, 06 May 2001, msuclay at hotmail.com wrote:

> Hey guys,
> 
> Thanks for the great forum.  I have a problem that I have been working on 
> and cannot find the answer.  I would appreciate any and all help.  Thanks.
> 
> Below is a small program that I have written to try to solve the problem 
> that I am having.  If you take a look at the program you will see a series 
> of 5 rows.  Each row has 3 radio buttons and an edit box for a number.  With 
> this program I would like to be able to select 1 radio button per row. This 
> program will only allow 1 radio button per page.  If the user selects the 
> left radio button I would like for it to multiply the value entered in the 
> edit box time 1.  If the user selects the middle radio button I would like 
> for it to multiply the value entered in the edit box times 2.  If the user 
> selects the right radio button I would like for it to multiply the value 
> entered in the edit box times 3.  Then display the answer in the total box 
> at the bottom.
> 
Just enclose the buttons that have to work "together" - meaning clicking one
clears the others in its group - in a group control (the outline box thingy)
So, for the above, you'd have 3 groups, one for each row.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

3. Re: Radio Buttons

This is a multi-part message in MIME format.

------=_NextPart_000_0022_01C0D62D.0F048240
	charset="Windows-1252"

Give this a whirl!

-- Travis --

> Below is a small program that I have written to try to solve the problem
> that I am having.  If you take a look at the program you will see a series
> of 5 rows.  Each row has 3 radio buttons and an edit box for a number.
With
> this program I would like to be able to select 1 radio button per row.
This
> program will only allow 1 radio button per page.  If the user selects the
> left radio button I would like for it to multiply the value entered in the
> edit box time 1.  If the user selects the middle radio button I would like
> for it to multiply the value entered in the edit box times 2.  If the user
> selects the right radio button I would like for it to multiply the value
> entered in the edit box times 3.  Then display the answer in the total box
> at the bottom.
>
> Thanks again,
>
> Clay


------=_NextPart_000_0022_01C0D62D.0F048240
Content-Type: application/octet-stream;
	name="msu.exw"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="msu.exw"

include win32lib.ew

with trace
without warning


global constant

panelwin =3D create( Window, "Load", 0, Default, Default, 230, 320, 0 ),

abtitle9 =3D create( LText, "Value", panelwin, 86, 10, 50, 40, 0 ),
x =3D create( EditText, "", panelwin, 85, 38, 50, 20, 0 ),
y =3D create( EditText, "", panelwin, 85, 66, 50, 20, 0 ),
z =3D create( EditText, "", panelwin, 85, 96, 50, 20, 0 ),
xx =3D create( EditText, "", panelwin, 85, 126, 50, 20, 0 ),
yy =3D create( EditText, "", panelwin, 85, 156, 50, 20, 0 ),

title1 =3D create( LText, "  1", panelwin, 1, 5, 20, 30, 0 ),
title2 =3D create( LText, "  2", panelwin, 26, 5, 20, 30, 0 ),
title3 =3D create( LText, "  3", panelwin, 51, 5, 20, 30, 0 ),

-- START EACH GROUP WITH WS_GROUP
a  =3D create( Radio, "", panelwin, 5, 40, 15, 10, WS_GROUP ),
b  =3D create( Radio, "", panelwin, 30, 40, 15, 10, 0 ),
c  =3D create( Radio, "1", panelwin, 55, 40, 23, 10, 0 ),
d  =3D create( Radio, "", panelwin, 5, 68, 15, 10, WS_GROUP ),
e  =3D create( Radio, "", panelwin, 30, 68, 15, 10, 0 ),
f  =3D create( Radio, "2", panelwin, 55, 68, 23, 10, 0 ),
g  =3D create( Radio, "", panelwin, 5, 98, 15, 10, WS_GROUP ),
h  =3D create( Radio, "", panelwin, 30, 98, 15, 10, 0 ),
i  =3D create( Radio, "3", panelwin, 55, 98, 23, 10, 0 ),
j  =3D create( Radio, "", panelwin, 5, 128, 15, 10, WS_GROUP ),
k  =3D create( Radio, "", panelwin, 30, 128, 15, 10, 0 ),
l  =3D create( Radio, "4", panelwin, 55, 128, 23, 10, 0 ),
m  =3D create( Radio, "", panelwin, 5, 158, 15, 10, WS_GROUP ),
n  =3D create( Radio, "", panelwin, 30, 158, 15, 10, 0 ),
o  =3D create( Radio, "5", panelwin, 55, 158, 23, 10, 0 ),

total =3D create( LText, "Total", panelwin, 1, 185, 100, 30, 0 ),
output =3D create( EditText, "", panelwin, 85, 185, 50, 20, 0 ),
line1 =3D create( LText, "----------------------------------------", =
panelwin,
0, 175, 300, 10, 0 ),
line2 =3D create( LText, "----------------------------", panelwin, 100, =
175,
300, 10, 0 ),
cal =3D create( PushButton, "Calculate", panelwin, 10, 230, 60, 30, 0 )





procedure onClick_cal()


  atom one, two, three, four, five, totall

  one =3D getNumber( x )
  two =3D getNumber( y )
  three =3D getNumber( z )
  four =3D getNumber( xx )
  five =3D getNumber( yy )



  totall =3D (one+two+three+four+five)

  setText( output, sprintf("%8.2f",totall))

end procedure


onClick[ cal ] =3D routine_id("onClick_cal")

WinMain( panelwin, Normal )

------=_NextPart_000_0022_01C0D62D.0F048240--

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu