إنشاء شريط أدوات خاص بك
#1
السلام عليكم
في هذا الدرس يمكنك من إنشاء شريط أدوات سريع لبرنامجك على ذوقك
ومن خلاله نفهم فكرة أشرطة الأدوات الموجودة عادة في العديد من البرامج
الدرس فلاشي كالعادة
كود :
http://www.mediafire.com/?qx08b99a8823w84
الرد
#2
شرح طيب جزاك الله خيرا
لأستهلنّ الصعب أو أدرك المنى    فما انقادت الآمال إلاّ لصابر
الرد
#3
وعليكم السلام ورحمة الله
في الواقع يستخدم يتم عادة استخدام TCoolBar وبداخله (نقر مزدوج لإضافة) عدة TCoolBand
يتم ربط كل TCoolBand بـ TActionToolBar (أو TActionMainMenuBar للقائمة الرئيسية) من الخاصية Control (هنا يأتي دور مكونات Action Bar من التبويب Additional)
الآن لإضافة أزرار على TActionToolBar قم بإضافة TActionManager وأنشئ فيه الأحداث التي تريد
وأخيرا اسحب وأفلت الأحداث (TAction) التي أنشأتها على TActionToolBar
وهكذا تحصل على قوائم بالضبط كالتي في محرر دلفي
مع إضافة TCustomizeDlg (التبويب Additional دائما) يمكنك إضافة إمكانية تعديل القوائم ديناميكيا لمستخدم برنامجك.
شيفرة ملف DFM لما سبق:
PHP كود :
object Form1: TForm1
  Left 
= 217
  Top 
= 135
  Width 
= 696
  Height 
= 480
  Caption 
= 'Form1'
  
Color = clBtnFace
  Font
.Charset = DEFAULT_CHARSET
  Font
.Color = clWindowText
  Font
.Height = -11
  Font
.Name = 'Tahoma'
  
Font.Style = []
  
OldCreateOrder = False
  PixelsPerInch 
= 96
  TextHeight 
= 13
  object CoolBar1
: TCoolBar
    Left 
= 0
    Top 
= 0
    Width 
= 688
    Height 
= 57
    Bands 
= <
      
item
        Control 
= ActionMainMenuBar1
        ImageIndex 
= -1
        Width 
= 684
      end
      item
        Control 
= ActionToolBar1
        ImageIndex 
= -1
        Width 
= 684
      end
>
    
object ActionMainMenuBar1: TActionMainMenuBar
      Left 
= 9
      Top 
= 0
      Width 
= 671
      Height 
= 25
      UseSystemFont 
= False
      ActionManager 
= ActionManager1
      Caption 
= 'ActionMainMenuBar1'
      
ColorMap.HighlightColor = 15660791
      ColorMap
.BtnSelectedColor = clBtnFace
      ColorMap
.UnusedColor = 15660791
      Font
.Charset = DEFAULT_CHARSET
      Font
.Color = clWindowText
      Font
.Height = -11
      Font
.Name = 'Tahoma'
      
Font.Style = []
      
Spacing = 0
      OnDblClick 
= ActionMainMenuBar1DblClick
    end
    object ActionToolBar1
: TActionToolBar
      Left 
= 9
      Top 
= 27
      Width 
= 671
      Height 
= 25
      ActionManager 
= ActionManager1
      Caption 
= 'ActionToolBar1'
      
ColorMap.HighlightColor = 15660791
      ColorMap
.BtnSelectedColor = clBtnFace
      ColorMap
.UnusedColor = 15660791
      Spacing 
= 0
    end
  end
  object XPManifest1
: TXPManifest
    Left 
= 408
    Top 
= 176
  end
  object ActionManager1
: TActionManager
    ActionBars 
= <
      
item
        Items 
= <
          
item
            Action 
= FileOpen1
            ImageIndex 
= 7
            ShortCut 
= 16463
          end
          item
            Action 
= FileOpenWith1
            Caption 
= 'O&uvrir avec...'
          
end
          item
            Action 
= FileSaveAs1
            ImageIndex 
= 30
          end
          item
            Caption 
= '-'
          
end
          item
            Action 
= FileExit1
            ImageIndex 
= 43
          end
>
        
ActionBar = ActionToolBar1
      end
      item
        Items 
= <
          
item
            Items 
= <
              
item
                Action 
= FileOpen1
                ImageIndex 
= 7
                ShortCut 
= 16463
              end
              item
                Action 
= FileOpenWith1
                Caption 
= 'O&uvrir avec...'
              
end
              item
                Action 
= FileSaveAs1
                ImageIndex 
= 30
              end
              item
                Action 
= FilePrintSetup1
                Caption 
= '&Configurer l''impression...'
              
end
              item
                Action 
= FilePageSetup1
                Caption 
= 'Co&nfigurer la page...'
              
end
              item
                Action 
= FileRun1
              end
              item
                Action 
= FileExit1
                ImageIndex 
= 43
              end
>
            
Caption = '&Fichier'
          
end
          item
            Items 
= <
              
item
                Action 
= EditCut1
                ImageIndex 
= 0
                ShortCut 
= 16472
              end
              item
                Action 
= EditCopy1
                ImageIndex 
= 1
                ShortCut 
= 16451
              end
              item
                Action 
= EditPaste1
                ImageIndex 
= 2
                ShortCut 
= 16470
              end
              item
                Action 
= EditSelectAll1
                ShortCut 
= 16449
              end
              item
                Action 
= EditUndo1
                ImageIndex 
= 3
                ShortCut 
= 16474
              end
              item
                Action 
= EditDelete1
                ImageIndex 
= 5
                ShortCut 
= 46
              end
>
            
Caption = '&Edition'
          
end
          item
            Caption 
= 'F&ormat'
          
end>
        
ActionBar = ActionMainMenuBar1
      end
      item
        Items 
= <
          
item
            Action 
= EditCut1
            ImageIndex 
= 0
            ShortCut 
= 16472
          end
          item
            Action 
= EditCopy1
            ImageIndex 
= 1
            ShortCut 
= 16451
          end
          item
            Action 
= EditPaste1
            ImageIndex 
= 2
            ShortCut 
= 16470
          end
          item
            Caption 
= '-'
          
end
          item
            Action 
= EditDelete1
            ImageIndex 
= 5
            ShortCut 
= 46
          end
          item
            Action 
= EditSelectAll1
            ShortCut 
= 16449
          end
>
      
end>
    
Left = 312
    Top 
= 112
    StyleName 
= 'XP Style'
    
object FileOpen1: TFileOpen
      Category 
= 'Fichier'
      
Caption = '&Ouvrir...'
      
Hint = 'Ouvrir|Ouvrir un fichier existant'
      
ImageIndex = 7
      ShortCut 
= 16463
    end
    object FileOpenWith1
: TFileOpenWith
      Category 
= 'Fichier'
      
Caption = 'Ouvrir avec...'
    
end
    object FileSaveAs1
: TFileSaveAs
      Category 
= 'Fichier'
      
Caption = 'Enregistrer &sous...'
      
Hint = 
        
'Enregistrer sous|Enregistrer le fichier actif sous un nouveau no' +
        
'm'
      
ImageIndex = 30
    end
    object FilePrintSetup1
: TFilePrintSetup
      Category 
= 'Fichier'
      
Caption = 'Config&urer l''impression...'
      
Hint = 'Configurer l''impression'
    
end
    object FilePageSetup1
: TFilePageSetup
      Category 
= 'Fichier'
      
Caption = '&Configurer la page...'
      
Dialog.MinMarginLeft = 0
      Dialog
.MinMarginTop = 0
      Dialog
.MinMarginRight = 0
      Dialog
.MinMarginBottom = 0
      Dialog
.MarginLeft = 2500
      Dialog
.MarginTop = 2500
      Dialog
.MarginRight = 2500
      Dialog
.MarginBottom = 2500
      Dialog
.PageWidth = 21000
      Dialog
.PageHeight = 29700
    end
    object FileRun1
: TFileRun
      Category 
= 'Fichier'
      
Browse = False
      BrowseDlg
.Title = 'Exécuter'
      
Caption = 'E&xécuter...'
      
Hint = 'Exécuter|Exécuter une application'
      
Operation = 'open'
      
ShowCmd = scShowNormal
    end
    object FileExit1
: TFileExit
      Category 
= 'Fichier'
      
Caption = '&Quitter'
      
Hint = 'Quitter|Quitter l''application'
      
ImageIndex = 43
    end
    object EditCut1
: TEditCut
      Category 
= 'Edition'
      
Caption = 'Cou&per'
      
Hint = 'Couper|Couper la sélection et la mettre dans le Presse-papiers'
      
ImageIndex = 0
      ShortCut 
= 16472
    end
    object EditCopy1
: TEditCopy
      Category 
= 'Edition'
      
Caption = '&Copier'
      
Hint = 'Copier|Copier la sélection et la mettre dans le Presse-papiers'
      
ImageIndex = 1
      ShortCut 
= 16451
    end
    object EditPaste1
: TEditPaste
      Category 
= 'Edition'
      
Caption = 'Co&ller'
      
Hint = 'Coller|Insérer le contenu du Presse-papiers'
      
ImageIndex = 2
      ShortCut 
= 16470
    end
    object EditSelectAll1
: TEditSelectAll
      Category 
= 'Edition'
      
Caption = '&Tout sélectionner'
      
Hint = 'Tout sélectionner|Sélectionner l''intégralité du document'
      
ShortCut = 16449
    end
    object EditUndo1
: TEditUndo
      Category 
= 'Edition'
      
Caption = '&Défaire'
      
Hint = 'Défaire|Rétablir la dernière action'
      
ImageIndex = 3
      ShortCut 
= 16474
    end
    object EditDelete1
: TEditDelete
      Category 
= 'Edition'
      
Caption = 'S&upprimer'
      
Hint = 'Supprimer|Efface la sélection'
      
ImageIndex = 5
      ShortCut 
= 46
    end
  end
  object CustomizeDlg1
: TCustomizeDlg
    ActionManager 
= ActionManager1
    StayOnTop 
= False
    Left 
= 176
    Top 
= 184
  end
end 
تركت أسماء الأغراض هنا الأسماء الافتراضية عند إضافتها، والأحداث القياسية التي استخدمت مرفقة مع المكون TActionManager
الحدث الوحيد الذي أضفته كان عند نقر مزدوج على TActionMainMenuBar
PHP كود :
CustomizeDlg1.Show; 
بالتوفيق.
الرد
#4
شكراً لك اخي alouma على الشرح
اخي كاش تعقيب ممتع على الادوات الاخرى الحقيقه بارك الله فيك
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم