dim. 22 octobre 2017, 19h35
eddymaue
atoutfox.public.association
Re: toolbar personnalisée ?
L'autre possibilité est de placer un container dans la toolbar et d'y
ajouter les controls désirés
je l'ai déjà fait mais je ne retrouve plus mes sources
bref il faut tenir compte des éléments suivants
docking horizontal (en haut ou en bas), vertical(a gauche ou a droite)
et aucun docking.
la solution simple que j'avais trouvé était que je doublais les
controles...
si docké
container invisible
controls visibles
si non docké
container visible
controls non visible
du code, du travaille mais cela se fait bien
bonne soirée et si possible revient nous avec une contribution
a+ Eddy
ybenam vient de nous annoncer :
> En fait les coordonnées n'ont aucune importance dans la classe toolbar.le
> seul moyen de placer les objets est le drag/drop manuel pour les mettrre dans
> l'ordre relatif voulu et d'effectuer des séparations (autant que nécessaire
> ) avec les controles "séparators". voila un exemple de code de toolbar avec
> 16 bouttons.cliquables.
*!*--Author Yousfi Benameur El Bayadh Algeria
*!*--Time stamp lundi 16 août 2010; 17:17:24
*!*--Subject :a custom toolbar
*!*--Version Vfp9Sp2
Local gnbre
gnbre=Adir(gabase,Home(1)+"graphics\bitmaps\tlbr_w95\*.bmp")
Create Cursor ycurs (yimg c(100))
For i=1 To 16
Insert Into ycurs Values (Home(1)+"graphics\bitmaps\tlbr_w95\"+gabase(i,1))
Endfor
*brow
Locate
*!*--Begin Code
Set Defa To Justpath(Sys(16))
yform = Newobject("yForm")
yform.Show
ytoolbar = Newobject("asup")
ytoolbar.Show()
Read Events
Return
Define Class yform As Form
ShowWindow = 2
Width=800
Height=600
AutoCenter=.T.
Caption="you can drag the toolbar and dock it left,top,right,bottom ou free"
Name="yform"
Procedure Destroy
Clea Events
Endproc
Enddefine
Define Class asup As Toolbar
ShowWindow = 1
Caption = "Toolbar1"
Height = 44
Left = 103
Top = 0
Width = 387
Name = "asup"
Add Object command1 As CommandButton With ;
Top = 3, ;
Left = 5, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(0,255,0), ;
Name = "Command1"
Add Object sep1 As Separator
Add Object command2 As CommandButton With ;
Top = 3, ;
Left = 53, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
Name = "Command2"
Add Object command3 As CommandButton With ;
Top = 3, ;
Left = 101, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,0), ;
Name = "Command3"
Add Object command4 As CommandButton With ;
Top = 3, ;
Left = 149, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command4"
Add Object command5 As CommandButton With ;
Top = 3, ;
Left = 197, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(255,128,255), ;
Name = "Command5"
Add Object command6 As CommandButton With ;
Top = 3, ;
Left = 245, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(255,128,0), ;
Name = "Command6"
Add Object command7 As CommandButton With ;
Top = 3, ;
Left = 293, ;
Height = 38, ;
Width = 41, ;
Picture ="", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command7"
Add Object command8 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
Name = "Command8"
Add Object command9 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command9"
Add Object command10 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
Name = "Command10"
Add Object command11 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command11"
Add Object command12 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command12"
Add Object command13 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command13"
Add Object command14 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command14"
Add Object command15 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
Name = "Command15"
Add Object sep2 As Separator &&make separator to set a space area between
2 controls. Add Object sep3 As Separator
Add Object sep4 As Separator
Add Object sep5 As Separator
Add Object command16 As CommandButton With ;
Top = 3, ;
Left = 341, ;
Height = 38, ;
Width = 41, ;
Picture = "", ;
Caption = "", ;
BackColor = Rgb(128,128,255), ;
Name = "Command16"
Procedure Init
This.Dock(0)
This.SetAll("mousepointer",15,"commandbutton")
For i=1 To This.ControlCount
If Lower(This.Controls(i).Class)="commandbutton"
Sele ycurs
This.Controls(i).Picture=yimg
Try
Skip
Catch
Endtry
Bindevent(This.Controls(i),"click",This,"my")
Endi
Endfor
Use In Select("ycurs")
Endproc
Procedure my()
Set Bell To (Addbs(Getenv('windir')))+"MEDIA\DING.WAV"
?? Chr(7)
Set Bell To
Messagebox("you can add some code to do some custom actions....",0+32)
Endproc
Enddefine
*!*End Code
--
Merci de partager avec moi votre immense savoir que je me ferai plaisir
d'absorber...
il va de soi que je vais vous en laisser un peu
Politesse et savoir vivre oblige ;0)
---
This email has been checked for viruses by AVG.
http://www.avg.com
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000018537