Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: Mes Procédures Mar 26 Fév 2013 - 19:21 | |
| Un petit outils que je suis entrain de me bricoler pour stocker et retrouver mes procédures plus facilement...et plus rapidement... ( moi qui est la mémoire qui flanche... ) - Code:
-
Application_title "Mes Procédures"
Constantes() Variables() Event() Interface() Init()
End ' Déclaration des constantes____________________________________________________ Sub Constantes() Dim Dos$ : Dos$=Dir_current$ Dim KGF$ :KGF$=Dos$+"\KGF.dll" End_Sub ' Déclaration des variables globales____________________________________________ Sub Variables() Dim Clic%,Change% Dim SF% End_Sub ' Déclaration des évènements____________________________________________________ Sub Event() Label Clic,Change End_Sub ' Mise en place de l'interface utilisateur______________________________________ Sub Interface() O_Form(0,0,1,0,0,480,660,"Mes Procédures"):font_name 0,"arial" O_Main_Menu(1,0) O_Sub_Menu(2,1,"Fichier",0):O_Sub_Menu(3,1,"Edit",0):O_Sub_Menu(4,1,"Options",0):O_Sub_Menu(5,1,"A Propos...",0):O_Sub_Menu(6,1,"Aide",0) O_Sub_menu(100,2,"Ouvrir",1):O_Sub_menu(101,2,"Nouveau",1):O_Sub_menu(102,2,"Quitter",1) O_Sub_menu(103,3,"Copier",1):O_Sub_menu(104,3,"Coller",1) ' Emplacement réservé pour de futur options O_Container(10,0,0,0,6,417,632,"") O_DList(14,"") O_Alpha(15,10,1,15,5,0,0,"Procédures :"):font_color 15,0,0,255 O_List(11,10,1,31,5,360,150,""):font_name 11,"courier new":On_Click 11,Clic:cursor_point 11 O_Alpha(16,10,1,15,160,0,0,"Code :"):font_color 16,0,0,255 O_Memo(12,10,1,31,160,170,460) :font_name 12,"courier new":Bar_Vertical 12:on_click 12,Clic O_Alpha(17,10,1,206,160,0,0,"Commentaires :"):font_color 17,0,0,255 O_Memo(18,10,1,221,160,170,460) :font_name 18,"courier new":Bar_Vertical 18:On_Click 18,Clic O_Alpha(13,10,1,395,10,0,0,""):Font_Color 13,0,0,255 O_Container(20,0,0,0,6,417,632,"") O_Alpha(21,20,1,15,10,0,0,"Catégorie :") O_Combo(22,20,1,30,10,0,150) O_Alpha(23,20,1,60,10,0,0,"Nom de la Sub :") O_Edit(24,20,1,75,10,0,150):on_change 24,Change O_Alpha(25,20,1,105,70,0,0,"Définition :") O_Memo(26,20,1,120,70,100,460):Bar_Vertical 26:on_click 26,Clic O_Alpha(27,20,1,225,70,0,0,"Sub :") O_Memo(28,20,1,240,70,120,460):Bar_Vertical 28:on_click 28,Clic O_Button(29,20,1,385,447,0,0,"Abandon",1) O_Button(30,20,1,385,527,0,0,"Enregistrer",1) End_Sub
Sub Init() Dll_on KGF$ End_Sub
Clic: Clic%=Number_click Select Clic% case 5 :APp() case 6 :Aide() case 11 :SF%=11:Clear 12:Clear 18:Selection(14) case 12 :SF%=12 case 18 :SF%=18 case 26 :SF%=26 case 28 :SF%=28 case 29 :Init_Nouveau() case 30 :Enregistrer() case 100:Init_Ouvrir() :show 10:if show(20)=1: hide 20:end_if:Choix_Categorie() case 101:Init_Nouveau():Show 20:if show(10)=1: hide 10:end_if case 102:Quitter() case 103:Copier(SF%) case 104:Coller(SF%) case 203:DLoad_File(Text$(202)+".ygc"):Hide 200:Show 10 End_Select Return
Sub Selection(No%) Dim_Local i%,a$,x%,Line1%,Line2%,b$ If count(11)>0 i%=item_index(11) a$=item_index$(11) Caption 13,a$ End_if ' définition du point de départ du chapitre Line1%=0 if count(No%)>0 for x%=1 to count(No%):if item_read$(No%,x%)="#"+a$:Line1%=x% :end_if:next x% end_if ' détermination du point de fin du chapitre Line2%=0 if line1%<count(No%) for x%=(Line1%+1) to count(No%):if left$(item_read$(No%,x%),1)="#":Line2%=x% :exit_for:end_if:next x% end_if ' lecture du chapitre dans No% - écriture dans 12 if Line2% >0 if (Line1%+1)<>Line2% for x%=(Line1%+1) to (Line2%-1) b$=item_read$(No%,x%) if left$(b$,1)="*" then item_add 12,right$(b$,len(b$)-1) if left$(b$,1)="$" then item_add 18,right$(b$,len(b$)-1) next x% end_if else if (Line1%+1)<count(No%) for x%=(Line1%+1) to count(No%) b$=item_read$(No%,x%) if left$(b$,1)="*" then item_add 12,right$(b$,len(b$)-1) if left$(b$,1)="$" then item_add 18,right$(b$,len(b$)-1) next x% end_if end_if End_Sub
Sub Init_Nouveau() Text 24,"":clear 26:clear 28:clear 22:Combo_Load(22) End_Sub
Sub Init_Ouvrir() Clear 12:Clear 18:Clear 11 End_Sub
Sub Choix_Categorie() Dim_Local hnd%,res%,flag% flag%=1 If Object_exists(200)=0 O_Form(200,0,1,0,0,100,250,"Catégorie"):Font_name 200,"arial" O_Alpha(201,200,1,10,10,0,0,"Catégorie :") O_Combo(202,200,1,25,10,0,180) O_Button(203,200,1,25,195,20,20,"Ok",1) Else Show 200 Clear 202 End_If Combo_Load(202) hnd%=handle_form("Catégorie") res%=dll_call2("WindowTopMost",hnd%,flag%) End_Sub
Sub Enregistrer() dim_local F$ F$=Text$(22)+".ygc" If File_Exists(F$)=1 Ajout_Proc(F$) Else Create_File_Proc(F$) End_If pause 1000 Init_Nouveau() End_Sub
Sub Ajout_Proc(File$) Dim_Local No%,x%,a$,b$ No%=Number_objects+1 O_Dlist(No%,File$) If Text$(24)<>"" item_add No%,"#"+Text$(24) if count(26)>0 for x%=1 to count(26):Item_add No%,"*"+item_read$(26,x%):next x% end_if if count(28)>0 for x%=1 to count(28):Item_add No%,"$"+Item_read$(28,x%):next x% end_if file_save No%,File$ else a$=string$(5," ")+"Procédure sans nom !" b$=string$((5+len(a$))/2," ")+"Attention !!!" message b$+chr$(13)+a$ end_if Delete No% End_Sub
Sub Create_File_Proc(File$) Dim_local x% file_open_write 1000,File$ If Text$(24)<>"" file_writeln 1000,"#"+Text$(24) if count(26)>0 for x%=1 to count(26):file_writeln 1000,"*"+item_read$(26,x%):next x% end_if if count(28)>0 for x%=1 to count(28):file_writeln 1000,"$"+item_read$(28,x%):next x% end_if file_close 1000 else a$=string$(5," ")+"Procédure sans nom !" b$=string$((5+len(a$))/2," ")+"Attention !!!" message b$+chr$(13)+a$ end_if End_Sub
Sub Quitter() Dll_Off terminate End_Sub
Sub Copier(No%) Clipboard_copy No% End_Sub
Sub Coller(No%) Clipboard_paste No% End_Sub
Sub APp() End_Sub
Sub Aide() End_Sub
Sub DLoad_File(T$) Dim_Local x%,a$ Clear 14 File_Load 14,T$ for x%=1 to count(14) a$=item_read$(14,x%):if left$(a$,1)="#":item_add 11,right$(a$,len(a$)-1):end_if next x% End_Sub
Change: Change%=Number_Change Select Change% case 24:Write_in26() End_Select Return
Sub Write_in26() dim_local x%,a$,b$,c$ item_delete 26,3 :item_delete 26,2:item_delete 26,1 a$=text$(24) for x%=1 to len(a$) b$=left$(a$,1) if b$=" " then b$="_" c$=c$+b$ a$=right$(a$,len(a$)-1) next x% item_add 26,"Sub "+c$+"()" item_add 26,"" item_add 26,"End_Sub" End_sub
Sub Combo_Load(No%) Dim_local x%,a$ a$=File_Find_First$ if Right$(a$,4)=".ygc":a$=Left$(a$,Len(a$)-4):Item_Add No%,a$:End_If a$=file_find_next$ While a$<>"_" If Right$(a$,4)=".ygc":a$=Left$(a$,Len(a$)-4):Item_Add No%,a$:End_If a$=File_Find_Next$ End_While File_Find_Close End_Sub
#include "Objet_Lib.bas" Voilà le fichier souffre douleur, il doit être enregistrer dans le dossier source sous le nom de "Objets.ygc": - Spoiler:
#FORM *Sub O_Form(No%,P%,V%,T%,L%,H%,W%,C$) * if No%> 0 then FORM No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 : Top No%,T% : Else : Top No%,(Screen_y-H%)/2 : End_If * If L% > 0 : Left No%,L%: Else : Left No%,(Screen_x-W%)/2: End_If * if C$<>"" then Caption No%,C$ *End_Sub #ALPHA *Sub O_Alpha(No%,P%,V%,T%,L%,H%,W%,C$) * ALPHA No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ *End_Sub #EDIT *Sub O_Edit(No%,P%,V%,T%,L%,H%,W%) * EDIT No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #BUTTON *Sub O_Button(No%,P%,V%,T%,L%,H%,W%,C$,Cl%) * BUTTON No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ * if Cl%> 0 then on_click No%,Clic * cursor_point No% *End_Sub #GRID *Sub O_Grid(No%,P%,V%,T%,L%,H%,W%) * GRID No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #CONTAINER *Sub O_Container(No%,P%,V%,T%,L%,H%,W%,C$) * CONTAINER No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ *End_Sub #SCENE3D *Sub O_Scene3D(No%,P%,V%,T%,L%,H%,W%) * SCENE3D No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L%
*End_Sub #MEMO *Sub O_Memo(No%,P%,V%,T%,L%,H%,W%) * MEMO No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #COMBO *Sub O_Combo(No%,P%,V%,T%,L%,H%,W%) * COMBO No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #LIST *Sub O_List(No%,P%,V%,T%,L%,H%,W%,F$) * LIST No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if F$<>"" * if file_exists F$ then file_load No%,F$ * end_if *End_Sub #PICTURE *Sub O_Picture(No%,P%,V%,T%,L%,H%,W%,P$) * PICTURE No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if P$<>"" then File_load No%,P$ *End_Sub #CHECK *Sub O_Check(No%,P%,V%,T%,L%,H%,W%,C$) * CHECK No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ *End_Sub #OPTION *Sub O_Option(No%,P%,V%,T%,L%,H%,W%,C$) * OPTION No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ *End_Sub #MAIN_MENU *Sub O_Main_Menu(No%,P%) * MAIN_MENU No% * if P% > 0 then Parent No%,P% *End_Sub #SUB_MENU *Sub O_Sub_Menu(No%,P%,C$,Cl%) * SUB_MENU No% * if P% > 0 then Parent No%,P% * if C$<>"" then Caption No%,C$ * If Cl%=1 then on_click No%,Clic *End_Sub #SOUND *Sub O_Sound(No%,P%,S$) * SOUND No% * If P%>0 then Parent No%,P% * If S$<>"" then file_load No%,S$ *End_Sub #MOVIE *Sub O_Movie(No%,P%,V%,T%,L%,H%,W%,M$) * MOVIE No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if M$<>"" then file_load No%,M$ *End_Sub #TRACK_BAR *Sub O_Track_Bar(No%,P%,V%,T%,L%,H%,W%) * TRACK_BAR No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #OPEN_DIALOG *Sub O_Open_Dialog(Out%,Filtre$,O%) * dim_local No%,F$ * No%=Number_objects+1 * OPEN_DIALOG No% * if filtre$<>"" then Filter No%,Filtre$ * F$=File_name$(No%) * if F$<>"_" * if O%=1 then text out%,F$ * if O%=2 then Caption Out%,F$ * if O%=3 then item_add Out%,F$ * if O%=4 then file_load Out%,F$ * end_if * Delete No% *End_Sub #SAVE_DIALOG ' Sub O_Save_Dialog(Filtre$) ' dim_local No%,F$ ' No%=Number_objects+1 ' SAVE_DIALOG No% ' if filtre$<>"" then Filter No%,Filtre$ ' F$=file_name$(No%) ' End_Sub #SCROLL_BAR *Sub O_Scroll_Bar(No%,P%,V%,T%,L%,H%,W%) * SCROLL_BAR No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #PROGRESS_BAR *Sub O_Progress_Bar(No%,P%,V%,T%,L%,H%,W%) * PROGRESS_BAR No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #SPIN *Sub O_Spin(No%,P%,V%,T%,L%,H%,W%) * SPIN No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #DLIST *Sub O_Dlist(No%,F$) * DLIST No% * if F$<>"" then file_load No%,F$ *End_Sub #SCENE2D *Sub O_Scene2D(No%,P%,V%,T%,L%,H%,W%) * SCENE2D No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% *End_Sub #TIMER *Sub O_Timer(No%,OO%,Inter%,OT%,T$) * TIMER No% * if OO%=1 then timer_on No% * if OO%=0 then timer_off No% * if inter%>0 then timer_interval No%,inter% * if OT%=1 * if T$<>"" * On_timer No%,T$ * end_if * end_if *End_Sub #CONTAINER_OPTION *Sub O_Container_Option(No%,P%,V%,T%,L%,H%,W%,C$) * CONTAINER_OPTION No% * if P% > 0 then Parent No%,P% * If V% = 0 Then hide No% * If H% > 0 Then Height No%,H% * If W% > 0 Then Width No%,W% * If T% > 0 Then Top No%,T% * If L% > 0 Then Left No%,L% * if C$<>"" then Caption No%,C$ *End_Sub #IMAGE *Sub O_Image(No%,I$) * if I$<>"" then file_load No%,I$ *End_Sub
J'ai oublié de dire ...d'écrire que la Lib est sur mon webdav et qu'il faut kgf.dll | |
|