Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Prac04
- Basado en el Ejercicio 11 de CuadernoPracticas
- para practicar la sentencia IF...ELSE */
- #include <radc++.h>
- //Declarar las variables globlales
- int i = 1; int j = 2;
- //create new form
- Form frmForma("Condicional IF..ELSE", 5,5,250,200);
- //create new text box
- Label lbli("Introduce valor de i:", AUTO_ID, 10,15, 100, 25, frmForma);
- NumberBox txtVali("2", AUTO_ID, 120, 15, 50, 25, frmForma);
- Label lblj("Introduce valor de j:", AUTO_ID, 10,45, 100, 25, frmForma);
- NumberBox txtValj("3", AUTO_ID, 120, 45, 50, 25, frmForma);
- ReadOnlyBox txtResult("Resultado:", AUTO_ID, 10, 75, 200, 25, frmForma);
- Button cmdDecide("Identifica", AUTO_ID, 10,110, 50, 25, frmForma);
- //create new control procedure for form, procedure1 is procedure name
- FormProcedure procedure1 (FormProcArgs) {
- //capture event ON_CLOSE which is fired when form is closed, [X] is clicked
- ON_CLOSE() {
- //exit application
- Application.close();
- }
- ON_COMMAND_BY(cmdDecide) {
- i = val( txtVali.text);
- j = val( txtValj.text);
- if (i>j)
- //frmForma.caption = "i es mayor que j";
- txtResult.text = "Resultado: i es mayor que j";
- else
- txtResult.text = "Resultado: i es menor que j";
- }
- //capture text change event, means text hs been changed
- //ON_TEXT_CHANGED ( text1 ) {
- // frmForma.caption = "Changed : " + text1.text;
- //}
- //always return 0
- return 0;
- }
- //rad c++ main program
- rad_main()
- txtVali.text = str(i);
- txtValj.text = str(j);
- //attach the created procedure with form
- frmForma.procedure = procedure1;
- //set focus to textbox when program starts
- txtVali.focus();
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement