Logo

GNUCOBOL (già OpenCobol) Italian Group

Nuova versione settembre 2019

Change language

Code Samples

IDENTIFICATION DIVISION.
PROGRAM-ID.    demo.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 alabel               usage pointer.

PROCEDURE DIVISION.

invoke SUPER "addform" returning SELF.
move  "GuiCOBOL TEST with a label blue with yellow "  to "caption" of self
invoke self "addlabel" using " blue label with yellow back" returning alabel.
move "blue" to "textcolor" of alabel
move "yellow" to "backcolor" of alabel.
move "arial" to "font" of alabel.
move "300%" to "fontsize" of alabel.
invoke  self "show"
invoke SELF "run"
stop run.

end program demo.

IDENTIFICATION DIVISION.
PROGRAM-ID.    demo.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 abox               usage pointer external.

PROCEDURE DIVISION.

invoke SUPER "addform" returning SELF.
invoke self "size" using 400 50
move  "GuiCOBOL TEST "  to "caption" of self
move "white" to "backcolor" of self
invoke self "addbox" returning abox
move "green" to "textcolor" of abox
move "this is the box caption" to "caption" of abox.
invoke abox "addlabel" using "a label " returning alabel
move "blue" to "textcolor" of alabel
move "magenta" to "backcolor" of alabel
invoke self "show"
invoke SELF "run"
stop run.

end program demo.


IDENTIFICATION DIVISION.
PROGRAM-ID.    demo.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 aside               usage pointer external.
01 bside               usage pointer external.
01 alabel              usage pointer.
PROCEDURE DIVISION.

invoke SUPER "addform" returning SELF.

move  "GuiCOBOL TEST with a pane container"  to "caption" of self
invoke self "addpane"  using "horiz"  returning aside bside.
invoke aside "addlabel" using " first label " returning alabel.
invoke bside "addpane"  using "vert"  returning aside bside.
invoke aside "addlabel" using " second label" returning alabel.
invoke bside "addlabel" using " blue label with yellow back" returning alabel.
move "yellow" to "backcolor" of alabel
move "blue" to "textcolor" of alabel
invoke self "show"
invoke SELF "run"
stop run.
end program demo.

 

IDENTIFICATION DIVISION.
PROGRAM-ID.    demo1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 stringa       pic is  x(100).
01 ageneric        usage pointer external.
01 attivo        usage pointer external.
01 abox         usage pointer external.
01 abox1         usage pointer external.
01 atext        usage pointer external.
01 abutton      usage pointer external.
01 abutton1     usage pointer external.
01 abutton2     usage pointer external.
01 alabel       usage pointer external.
01 aradio       usage pointer external.


PROCEDURE DIVISION.

invoke SUPER "addform" returning SELF.
invoke SELF "size" using 900  500
invoke self "addspaceshoriz"
move "MIDDLERIGHT" TO "position" of self
move  "GuiCOBOL TEST FOR GNUCOBOL "  to "caption" of sel

move "orangered" to "backcolor" of self.
move "darkgreen" to "textcolor" of self.
move "120%" to "fontsize" of self.
move spaces to stringa.
move "caption" of  self  to stringa.
invoke self "addpane" using "v" returning abox abox1.
move "1" to "homogenous" of abox.
invoke abox "addtext" using "First name " returning atext
move "90%" to "fontsize" of atext.

move "blue" to "backcolor" of atext.
move "yellow" to "textcolor" of atext.
move "x(30)" to "render" of atext
move "write your first name here"      to "text" OF atext

invoke atext "refresh"

invoke abox "addtext" using "Second name " returning ate
move "90%" to "fontsize" of atext.
move "blue" to "backcolor" of atext.
move "yellow" to "textcolor" of atext.

invoke self "addspaceshoriz"
invoke abox "addcombo" using "Gender"   returning abutto

move "x(10)" to "render" of abutton.
move 2 to "maxitem" of abutton.

invoke abutton "additem"  using "male"
invoke abutton "additem"  using "female"
invoke abox "addbox" using "right panel                "

PERFORM 5 TIMES
Invoke abox using "addspaceshoriz"
END-PERFORM.

invoke abox "addbox" returning abox.
invoke abox  "addradioto" using "pressedkey"  returning
move "h" to "disposition" of aradio


invoke aradio "additem"  using "choice one"
invoke aradio  "additem"  using "choice two"
invoke aradio  "additem"  using "choice three"
invoke aradio  "additem"  using "choice four"
invoke aradio  "additem"  using "choice five"
invoke self "show"
invoke SELF  "Closed" using "exitForm"
invoke SELF "run"
stop run.

end program demo1.


identification division.
program-id. exitForm.
data division.
working-storage section.

procedure division.
invoke self "close".
invoke self  "stoprun".
display "you are exitform".
exit program.
end program exitForm.


identification division.
program-id. DefaultOpened.
data division.
working-storage section.
linkage section.
procedure division .
display "sono in Defaultopen".
exit program.
end program DefaultOpened.

method-id. pressedkey.
procedure division.
move "you pressed a radio options" to "info" of self
exit program.
end method.