Invité Invité
| Sujet: Un petit utilitaire léger : MultiTools Ven 21 Mai 2010 - 16:25 | |
| Je vous présente mon nouveau petit utilitaire. Pour tout de suite il y a des bouton qui ne serve à rien mais quand même 3 bouton fonctionne. Mon code du post Heure sans boucle infini est dedans. JL35 l'as dit pour ceux qui n'ont pas la date à l'anglo-saxonne vous pouvez modifier le petit bout dans le code suivant : - Code:
-
label quit,reduire,agrandir,compte,suite,convert,retour label chrono,timers,start,arret,continu,convertir,note label size,police,ajoute,selectionne dim chrono,k,mess,convert,r,r2,note,n,t dim agrand,temps$,odate$,mois$(12),moisact$ dim i,j
n=100
mois$(1)="janvier":mois$(2)="février":mois$(3)="mars":mois$(4)="avril" mois$(5)="mai":mois$(6)="juin":mois$(7)="juillet":mois$(8)="août" mois$(9)="septembre":mois$(10)="octobre":mois$(11)="novembre":mois$(12)="décembre"
left 0,screen_x/2-100 top 0,screen_y/2-110 width 0,200 height 0,100 border_hide 0 caption 0,"MultiTools V.1.0"
picture 1 width 1,200 height 1,21 color 1,0,100,255
picture 15 top 15,21 width 15,200 height 15,79 2d_target_is 15 2d_fill_color 233,232,218 2d_rectangle 0,0,200,79
alpha 6 left 6,5 top 6,2 font_bold 6 font_color 6,255,255,255 color 6,0,100,255:font_size 6,10:font_name 6,"Tahoma" caption 6,"MultiTools V.1.0"
button 2 left 2,180:top 2,2:width 2,17:height 2,17:on_click 2,quit font_size 2,10:font_name 2,"Webdings":caption 2,"r":hint 2,"Fermer"
button 3 left 3,161:top 3,2:width 3,17:height 3,17:on_click 3,agrandir font_size 3,10:font_name 3,"Webdings":caption 3,"2":hint 3,"Niveau inférieur"
button 4 left 4,142:top 4,2:width 4,17:height 4,17:on_click 4,reduire font_size 4,10:font_name 4,"Webdings":caption 4,"0":hint 3,"Réduire"
temps$=left$(time$,2)+" h "+mid$(time$,4,2)+" m "+right$(time$,2)+" s." for i=1 to 9 if mid$(date$,6,2)="0"+str$(i) then moisact$=mois$(i) next i for i=10 to 12 if mid$(date$,6,2)=str$(i) then moisact$=mois$(i) next i odate$=right$(date$,2)+" "+moisact$+" "+left$(date$,4)
alpha 5 left 5,5 top 5,26 font_size 5,10 caption 5,"Heure: "+temps$+chr$(10)+"Date: "+odate$
j=2 for i=7 to 14 button i:left i,j:top i,76:height i,21:width i,21:font_size i,10:j=j+25 next i caption 7,"Ch":caption 8,"Co":caption 9,"No" hint 7,"Chronomètre":hint 8,"Convertir une distance avec un temps pour obtenir la vitesse en km/h":hint 9,"Prendre une note" on_click 7,chrono:on_click 8,convertir:on_click 9,note
timer 16 on_timer 16,compte
' invisible ____________________________________________________________________
alpha 17 hide 17 left 17,5 top 17,28
spin 18 hide 18 left 18,40 top 18,26 width 18,60 position 18,60 min 18,1:max 18,100000
j=105 for i=19 to 20 button i:left i,j:top i,26:width i,42:height i,21:font_size i,12:font_name i,"Webdings":hide i:j=j+47 next i caption 19,"4":caption 20,";":inactive 20 on_click 19,start:on_click 20,arret
timer 21
edit 22 hide 22 left 22,5 width 22,189 top 22,52
spin 23 hide 23 left 23,75 top 23,76 width 23,55 min 23,50:max 23,30000:position 23,"1000" on_key_up 23,suite
j=26 for i=24 to 25 spin i:left i,53:top i,j:width i,80:hide i:j=j+26 next i
button 26:hide 26:left 26,27:width 26,168:top 26,76:height 26,21
list 27 hide 27 left 27,274 top 27,26 height 27,195 if file_exists("C:\Program files\MultiTools\LISTE.list")=0 then file_save 27,"C:\Program files\MultiTools\LISTE.list" file_load 27,"C:\Program files\MultiTools\LISTE.list" on_click 27,selectionne
memo 28 hide 28 top 28,26 left 28,5 width 28,264 height 28,195 bar_both 28
button 29 hide 29 left 29,28 top 29,226 height 29,21 width 29,60 caption 29,"Ajouter" on_click 29,ajoute
combo 30 left 30,93 top 30,226 font_names_load 30 text 30,"Arial" on_click 30,police
spin 31 top 31,226 left 31,243 width 31,40 min 31,6:max 31,30 position 31,8 on_change 31,size
memo 32:hide 32
edit 33 left 33,288 top 33,226 width 33,108 text 33,"Nom" on_key_up 33,ajoute
end
reduire: return
agrandir: if (agrand=0) caption 3,"1" height 0,21:hint 3,"Agrandir" agrand=1 else caption 3,"2" height 0,n:hint 3,"Niveau inférieur" agrand=0 end_if return
compte: temps$=left$(time$,2)+" h "+mid$(time$,4,2)+" m "+right$(time$,2)+" s." for i=1 to 9 if mid$(date$,6,2)="0"+str$(i) then moisact$=mois$(i) next i for i=10 to 12 if mid$(date$,6,2)=str$(i) then moisact$=mois$(i) next i odate$=right$(date$,2)+" "+moisact$+" "+left$(date$,4) caption 5,"Heure: "+temps$+chr$(10)+"Date: "+odate$ return
' Chronomètre __________________________________________________________________
chrono: if (chrono=0) hide 5 for i=8 to 14 hide i next i caption 6,"Chronomètre":caption 17,"temps:"+chr$(10)+chr$(10)+chr$(10)+chr$(10)+" Intervale: millisecondes" show 17:show 18:show 19:show 20:show 22:show 23:set_focus 18 chrono=1 else show 5 for i=8 to 14 show i next i hide 17:hide 18:hide 19:hide 20:hide 22:hide 23 caption 6,"MultiTools V.1.0" chrono=0 end_if return
start: active 20 k=text$(18) text 22,str$(k) timer_on 21 on_timer 21,timers return
continu: timer_on 21 caption 20,";" on_click 20,arret return
timers: k=k-1 text 22,str$(k) if k=0 then beep:timer_off 21:on_click 19,start:inactive 20:goto arret return
arret: timer_off 21 caption 20,":" on_click 20,continu return
suite: if key_up_code=13 if position(23)>30000 or position(23)<50 then message "Erreur! La valeur est trop grande ou trop petite.":position 23,1000:timer_interval 21,1000:return timer_interval 21,position(23) end_if return
' Convertir ____________________________________________________________________
convertir: if (convert=0) convert=1 left 8,2:hide 5:hide 7 for i=9 to 14 hide i next i show 17:caption 17,"Distance: Mètre(s)"+chr$(10)+chr$(10)+"Temps: seconde(s)" show 24:show 25:show 26:caption 26,"Convertir" caption 6,"Convertir":set_focus 24:on_click 26,convert else convert=0 caption 6,"MultiTools V.1.0" hide 24:hide 25:show 5:left 8,27:show 7:hide 17:hide 26:font_size 17,8 for i=9 to 14 show i next i end_if return
convert: if text$(25)="0" then beep:return r=(val(text$(24))/val(text$(25)))*3.6 r2=int((val(text$(24))/val(text$(25)))*3.6+0.5) hide 24:hide 25:caption 26,"Retour":on_click 26,retour font_size 17,10:caption 17,"Résultat:"+chr$(10)+" "+str$(r)+" km/h"+chr$(10)+" "+str$(r2)+" km/h" return
retour: caption 26,"Convertir":on_click 26,convert:position 24,0:position 25,0 show 24:show 25:font_size 17,8:caption 17,"Distance: Mètre(s)"+chr$(10)+chr$(10)+"Temps: seconde(s)" return
' Note _________________________________________________________________________
note: if (note=0) note=1 width 0,400 height 0,250 width 1,400:color 1,0,100,255 width 15,400:height 15,229:2d_rectangle 0,0,400,229 hide 5:left 9,2:top 9,226:hide 7:hide 8 for i=10 to 14 hide i next i left 2,380:left 3,361:left 4,342 left 0,screen_x/2-200:top 0,screen_y/2-125 caption 6,"Prendre une note":show 27:show 28:set_focus 28:show 29:show 30:show 31 n=250 else note=0 left 2,180:left 3,161:left 4,142 for i=10 to 14 show i next i top 9,76:left 9,52:show 5:show 7:show 8 width 0,200:height 0,100:left 0,screen_x/2-100:top 0,screen_y/2-110 width 15,200:height 15,79:2d_rectangle 0,0,200,79 caption 6,"MultiTools V.1.0":hide 27:hide 28:hide 29:hide 30:hide 31 n=100 end_if return
police: font_name 28,text$(30) return
size: if text$(31)="" then return if position(31)>30 or position(31)<6 then beep:return font_size 28,text$(31) return
ajoute: if key_up_code=13 or clicked(29)=1 item_add 32,text$(30) item_add 32,position(31) for i=1 to count(28) item_add 32,item_read$(28,i) next i if dir_exists("C:\Program files")=0 then dir_make "C:\Program files" if dir_exists("C:\Program files\MultiTools")=0 then dir_make "C:\Program files\MultiTools" if file_exists("C:\Program files\MultiTools\"+text$(33)+".mtn")=1 then file_delete "C:\Program files\MultiTools\"+text$(33)+".mtn":return file_save 32,"C:\Program files\MultiTools\"+text$(33)+".mtn" file_delete "C:\Program files\MultiTools\LISTE.list" item_add 27,text$(33) file_save 27,"C:\Program files\MultiTools\LISTE.list" end_if return
selectionne: file_load 32,"C:\Program files\MultiTools\"+item_index$(27)+".mtn" text 30,item_read$(32,1):text 33,item_index$(27) t=item_read$(32,2) position 31,str$(t) font_size 28,str$(t):font_name 28,text$(30) clear 28 for i=3 to count(32) item_add 28,item_read$(32,i) next i return
quit: mess=message_confirmation_yes_no("Voulez-vous vraiment sortir de MultiTools?") if mess=0 or mess=2 then return terminate |
|