** ****************************************************************************************** * **EndUser4gl : Exemple d'un langage de 4 ème génération ** ******************************************************************************************* ** ** initialize dialog and Link Structure xxx with Windows in BLOC INITIALIZE ** #include "c:\EndUser4gl\4gl\hlp\IncludeSysEU\includesyseu.h" integer : exit_trans1 ,x,yColor:=255,ival ,itemTabCtl,itemid; char : toto:50 := "1234567890", texte1:50 := "Itemxxcccccccccccc" ; long : C_BLUE; char : wordNumeric:128 ,value1:128 ; constant_num : ID_PRINT 101 , ID_COPY 102 ,ID_CANCEL 106 ; constant_string : CUTBMP "c:\EndUser4gl\4gl\hlp\PgmBmp\cut.bmp",ITEMCUT "Cut" ; struct : ref { char Name: 25 , Surname:15 , Adresse:40 , Town:30 , Telephon:24, Fax:24, Country:20 ; long CodeTown ; } begin_transaction : Trans1 Execute Transaction with exit_trans1 != 1 begin_dialog Backgroundcolor : color(98,120,250) WinExtendstyle : :WS_EX_DLGMODALFRAME Winstyle : :WS_OVERLAPPED & :WS_CAPTION & :WS_SYSMENU & : WS_VSCROLL & :WS_HSCROLL & :WS_MINIMIZEBOX & :WS_MAXIMIZEBOX & FULLDIALOG 100,250,800,600, " EndUser Dialog",UserDialog Begin_Menu : menu1 Begin_PopMenu : PopMenu1 "O&ption 1.." MenuItem "&Open" , ID: 101 Begin_SubMenu : SubMenu1 "Print...." MenuItem " Print21" , ID: 102 create : pictureBmp "c:\EndUser4gl\4gl\hlp\PgmBmp\print.bmp" MenuItem " Print22" , ID: 103,DISABLE End_SubMenu MenuItem return_carriage MenuItem ITEMCUT , ID :104 create : pictureBmp CUTBMP MenuItem "S&Ave All" , ID :105 create : pictureBmp "c:\EndUser4gl\4gl\hlp\PgmBmp\save.bmp" MenuItem return_carriage MenuItem "&Cancel" , ID: ID_CANCEL create : pictureBmp "c:\EndUser4gl\4gl\hlp\PgmBmp\cancel.bmp" END_PopMenu Begin_PopMenu : PopMenu2 "Op&tion 2.." MenuItem "execute " , ID: 20,,DISABLE MenuItem "Stop" , ID :21 MenuItem return_carriage MenuItem "Cop&y" , ID :22 create : pictureBmp "c:\EndUser4gl\4gl\hlp\PgmBmp\copy.bmp" MenuItem "Coller" , ID:23 create : pictureBmp "c:\EndUser4gl\4gl\hlp\PgmBmp\paste.bmp" END_PopMenu END_Menu Begin_Rebar TOP Rebar1 150,50 ButtonIconDraw 70,1, 32,32, "c:\EndUser4gl\4gl\hlp\pgmicon\ok2.ico", ButtonIcon1 create : info "rebar @ Example Button IconDraw \\n...", use Cursor "c:\EndUser4gl\4gl\hlp\PgmCursor\hand-l.cur" ButtonIconDraw 170,1, 32,32, "c:\EndUser4gl\4gl\hlp\pgmicon\cancel.ico", ButtonCancel2 create : info "rebar @ Example Button IconDraw \\n Exit.." , use Cursor "c:\EndUser4gl\4gl\hlp\PgmCursor\hand-l.cur" End_Rebar Begin_Toolbar TOP SPACE 260 PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\10.ico" , PushIcon1 Create : Info "Option toolbar @ Programming : Create : \\n Info l_string.." PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\431.ico" , PushIcon2 Create : Info " Option toolbar @ Read CD ROM..." PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\57.ico" , PushIcon3 Create : Info "Option toolbar @ Good Night........" PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\109.ico" , PushIcon4 Create : Info "Option toolbar @ STOP ALERTE !!!!!...." PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\317.ico" , PushIcon5 Create : Info "Option toolbar @ Programming : create Info : it's optional" PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\27.ico" , PushIcon6 Create : Info " Option toolbar @ Other Transaction...." PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\35.ico" , PushIcon7 Create : Info " Option toolbar @ Notes..........." PushIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\36.ico" , PushIcon8 Create : Info " Option toolbar @ What is this ???.." End_Toolbar Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 19,35, 49, 25, "Name " ,text1 Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 60, 137, 25, "Surname (prénom)" ,text2 Text: WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 90, 61, 25, "Adresse" ,text3 Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 120, 93, 25, "Code Town" ,text4 Text: WinExtendstyle : :0 Winstyle : :SS_LEFT 19,150, 80, 25, "Town Ville" ,text5 Text: WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 180, 72, 25, "Telephon" ,text6 Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 210, 28, 25, "Fax" ,text7 Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 19, 240, 90, 25, "Pays/Country" ,text8 TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190, 30, 315, 25, ZoneTexte1 create : like ref.name Rectangle 187, 57,165, 30, BkColor41 Attribut : FillColor : 0,145,145 FrameColor : 0,145,145 TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190, 60, 160, 25, ZoneTexte2 create : like ref.surname TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190, 90, 412, 25, ZoneTexte3 create : like ref.adresse TextBox: WinExtendstyle : :WS_EX_CLIENTEDGE Winstyle : :ES_LEFT & :ES_NUMBER 190, 120, 110, 25, ZoneTexte4 create : like ref.CodeTown TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190,150, 268, 25, ZoneTexte5 create : like ref.Town TextBox : WinExtendstyle : :WS_EX_CLIENTEDGE Winstyle : :ES_LEFT & :ES_NUMBER 190, 180, 160, 25, ZoneTexte6 create : like ref.Telephon TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190, 210, 160, 25, ZoneTexte7 create : like ref.Fax TextBox : WinExtendstyle : :0 Winstyle : :ES_LEFT 190, 240, 160, 50, ZoneTexte8 create : like ref.Country /* ---->COMBOBOX */ Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 650,60, 80, 20, "Combobox" ,text9 Combobox 740,60, 160, 150, Zonecountry /* ---->LISTBOX*/ Text : WinExtendstyle : :0 Winstyle : :SS_LEFT 650,100, 80, 20, "Lisbox" ,text10 Listbox : WinExtendstyle : :WS_EX_CLIENTEDGE Winstyle : :LBS_NOTIFY & :LBS_SORT & :WS_VSCROLL & :WS_BORDER 740,100, 180, 80, Zonecountry2 PictureGIF 30 ,295, "c:\EndUser4gl\4gl\hlp\PgmGif\gifanimate\theend.gif",GifEndUser1 ButtonRegionChild 30,295,48,48, BoutonCancel create : use Cursor "c:\EndUser4gl\4gl\hlp\PgmCursor\hand-l.cur" , info " Informations Quit @ CopyRight EndUser4gl Mai 2001 Ph Bergougnoux " PictureGif 470, 460,"c:\EndUser4gl\4gl\hlp\PgmGif\gifanimate\iExplorer.gif",GifExplorer ButtonText 470 , 500, 170,20, " www.enduser4gl.com ", ButtonWWW create : use Cursor "c:\EndUser4gl\4gl\hlp\PgmCursor\hand-l.cur" , info " Option Internet @ Connect to www.enduser4gl.com" /* ---->LISTVIEW STANDARD EDIT ALL ROWS */ ListView : :LVS_REPORT & :LVS_EDITLABELS 370,180, 600, 200, ListView1 create : column 1 : "Nom ", column 2 : "Prénom", column 3 : "adresse ", column 4 : "code Postal", column 5 : "Ville " , use FRAMEWORK /* ---->TREEVIEW */ TreeView : :TVS_HASLINES & :TVS_HASBUTTONS & :TVS_LINESATROOT 640,410, 250, 180, TreeView1 create : with PictureIcon : "c:\EndUser4gl\4gl\hlp\pgmicon\65.ico" /* ---->TABCONTROL */ Begin_TabControl TabCtl1: :TCS_HOTTRACK & :TCS_VERTICAL 20,360, 330,320 Begin_TabControlItem 1 : "Item n°1" with pictureicon :32516 TextBox : WinExtendstyle : :WS_EX_CLIENTEDGE Winstyle : :ES_LEFT & : ES_UPPERCASE &:ES_MULTILINE 40, 20, 270, 285, text11 End_TabControlItem Begin_TabControlItem 2 : "Item n°2" with pictureicon :32514 TreeView : 40, 20, 270, 285, TreeView2 End_TabControlItem Begin_TabControlItem 3 : "Item n°3" with pictureicon :"c:\EndUser4gl\4gl\hlp\pgmicon\75.ico" ListView : :LVS_REPORT 40, 20, 270, 285, ListView2 create : column 1 : "Colonne 1", column 2 : "Colonne 2", column 3 : "Colonne 3" End_TabControlItem End_TabControl /* ---->GRID EDIT ALL ROWS */ Grid 360,620, 600, 250, Grid1 Property : HeightColumn 64 HeightLine 40, Max Column 10, Max lines 50 create : column 1 : "Colonne 1 PushButton" ,Property :PushButton,size 50 column 2 : "Colonne 2 Icon" ,Property : size 40, pictureicon : "c:\EndUser4gl\4gl\hlp\pgmicon\10.ico" width Icon: 32 ,height Icon : 16 column 3 : "Colonne 3 CHECKBOX",Property : Checkbox,size 40 column 4 : "Colonne 4 CHAR" ,Property : char,size 200,RIGHT column 5 : "Colonne 5 STRING" ,Property : char,size 70,CENTER column 6 : "Colonne 6 Icon" ,Property : size 30,pictureicon : "c:\EndUser4gl\4gl\hlp\pgmicon\sunsmile.ico" width Icon: 25 ,height Icon : 18 column 7 : "Colonne 7 CHECK",Property : CHECK,size 40 column 8 : "Colonne 8 Integer" ,Property : integer,size 50,RIGHT column 9 : "Colonne 9 Icon" ,Property : size 70, pictureicon : "c:\EndUser4gl\4gl\hlp\pgmicon\19.ico" width Icon: 16 ,height Icon : 16 column 10 : "Colonne 10 Integer" ,Property : integer,size 50,RIGHT end_dialog Begin_Initialize ref.surname := "Philippe" ; ref. Adresse := "14 rue Jean Moulin" ; ref.Town := "St Avertin" ; ref.CodeTown := 37550; ref.Telephon := "00.33.2.47.28.58.19" ; ref.Fax := "00.33.2.47.28.58.19" ; ref.Country := "France" ; SetBkColorGif( GifEndUser1:YELLOW); SetColorText(buttonWWW:blue, white ); require enableWindow(ZoneTexte2) ; ref.name := " EndUser4gl........" ; IconDialog(UserDialog:"c:\EndUser4gl\4gl\hlp\pgmicon\19.ico"); ** -1 : no background color SetColorText (Text1:RED,-1); SetColorText (Text2:black,-1); SetColorText (Text3:black,-1); SetColorText (Text4:green,-1); SetColorText (Text5:cyan,-1); SetColorText (Text6:yellow,-1);SetColorText (Text7:green,-1); SetColorText (Text8:orange,-1); SetColorText (Text9:red,-1); SetColorText (Text10:green,-1); SetColorText (ZoneTexte1:RED,-1); SetColorText (ZoneTexte2:blue,-1); SetColorText (ZoneTexte4:green,-1); SetColorText (ZoneTexte5:cyan,-1); SetColorText (ZoneTexte6:red,-1); SetColorText (ZoneTexte8:yellow,-1); AddComBoBox( ZoneCountry:"France"); AddComBoBox( ZoneCountry:"England"); AddComBoBox( ZoneCountry:"Usa"); AddComBoBox( ZoneCountry:"Italia"); AddComBoBox( ZoneCountry:"Deutschland"); AddComBoBox( ZoneCountry:"Belgium"); AddListBox(ZoneCountry2:"France"); AddListBox(ZoneCountry2:"England"); AddListBox(ZoneCountry2:"Usa"); AddListBox(ZoneCountry2:"Italia"); AddListBox(ZoneCountry2:"Deutschland"); AddListBox(ZoneCountry2:"Belgium"); AddListBox(ZoneCountry:"Pologne"); AddListBox(ZoneCountry:"Russie"); SetBkColorGD(Grid1: column: 1 GRAY,column: 2 YELLOW, column: 3 RED,column : 5 BLUE,column:8 PINK); SetColortextGD(Grid1: column: 5 GREEN, column: 6 BLUE,column: 10 ORANGE); do(20) Ival++; ConverNumeric Ival to wordNumeric format "05" ; StringConcat texte1 to wordNumeric ; AddItemGD(Grid1:Ival, column:1 Ival,column: 3 $_UNCHECK , column:4 WordNumeric, column:5 "azerty", column:8 Ival, column:10 124 ); Clear wordNumeric ; ** important p/ StringConcat end_do; /*Treeview */ do(3) AddItemTV(TreeView1:1,"Level/Niveau 1"); AddItemTV(TreeView1:2,"Level/Niveau 2.1"); AddItemTV(TreeView1:2,"Level/Niveau 2.2"); AddItemTV(TreeView1:2,"Level/Niveau 2.3"); AddItemTV(TreeView1:3,"Level/Niveau 3"); AddItemTV(TreeView1:4,"Level/Niveau 4"); AddItemTV(TreeView1:5,"Level/Niveau 5"); end_do; /* TabControl */ AddItemTV(TreeView2:1,"Level/Niveau 1"); AddItemTV(TreeView2:2,"Level/Niveau 2.1"); AddItemTV(TreeView2:2,"Level/Niveau 2.2"); AddItemTV(TreeView2:2,"Level/Niveau 2.3"); AddItemTV(TreeView2:3,"Level/Niveau 3"); AddItemTV(TreeView2:4,"Level/Niveau 4"); AddItemTV(TreeView2:5,"Level/Niveau 5"); SetSelectItemTC(TabCtl1:2);SetActiveWinItemTC(TabCtl1:2); SetBkColorLV(ListView1:GRAY); do(7) begin /* Add item ligne in ListView */ color(0,0,YColor) returning(C_BLUE); SetColortextLV(ListView1:RED,C_Blue); AddItemLV(ListView1:1,"Bergougnoux"); SetItemLV(ListView1:2,"Philippe"); /* modif Item ligne existante */ SetItemLV(ListView1:3,"14 rue Jean Moulin"); SetItemLV(ListView1:4,"37550"); SetItemLV(ListView1:5,"TOURS/ST AVERTIN"); AddItemLV(ListView1:1,"Dupont"); SetItemLV(ListView1:2,"george"); /* modif Item ligne existante */ SetItemLV(ListView1:3,"12 rue Pasteur"); SetItemLV(ListView1:4,"75014"); SetItemLV(ListView1:5,"PARIS"); OpenDialog (UserDialog) ; begin /* Add item ligne in ListView */ SetColortextLV(ListView1:BLUE,YELLOW); AddItemLV(ListView1:1,"Durand"); SetItemLV(ListView1:2,"andré"); /* modif Item ligne existante */ SetItemLV(ListView1:3,"101 Bld Kléber"); SetItemLV(ListView1:4,"13000"); SetItemLV(ListView1:5,"MARSEILLE"); end_begin ; OpenDialog (UserDialog) ; end_begin ; end_do; End_Initialize OpenDialog (UserDialog) ; InputData(); GetselectPopMenuItemID() returning(ItemID); if(ItemId Not_Void) then display "GetselectPopMenuItemID() returning(ItemID)....: ",ItemId ; IF(ItemId = 106) then MsgBox : TITLE "My First Menu " Message : " Push is ok : Cancel Transaction" button : MB_OK icon : MB_ICONEXCLAMATION returning (x) ; exit_trans1 := 1 ; end_if; end_if; ** ************************************************************************************ ** If Click on Dialog : Message Windows ** ************************************************************************************ Begin_Message_Dialog(UserDialog)::OnClickDialog(void) require GetPush(BoutonCancel) returning (x); if( x Not_Void ) then MsgBox : TITLE "My First Dialog" Message : " Push is ok : Cancel Transaction............" button : MB_OK icon : MB_ICONEXCLAMATION returning (x) ; exit_trans1 := 1 ; end_if; require GetPush( ButtonCancel2) returning (x); if( x Not_Void ) then MsgBox : TITLE "My First Dialog" Message : " Push is ok : Cancel Transaction............" button : MB_OK icon : MB_ICONEXCLAMATION returning (x) ; exit_trans1 := 1 ; end_if; Begin /* Click on EndUser4gl Site enduser4gl */ require GetPush(buttonWWW) returning (x); if( x Not_Void ) then SetHourGlassCursor(); NavigateInternet("www.enduser4gl.com");Return_Begin_transaction(Trans1) ; end_if; End_begin ; Begin /* Test select item TABControl */ IsOnSetCursor(TabCtl1) returning(x); if( x Not_Void ) then GetSelectItemTC(TabCtl1) returning(itemTabCtl); if( itemTabCtl Not_Void ) then SetActiveWinItemTC(TabCtl1: itemTabCtl); end_if; end_if; end_begin ; End_Message_Dialog /* WM_xxxxx */ end_transaction