Page 1 of 1

SetTBbuttonTooltip and minimize window problem

Posted: Fri May 09, 2003 1:38 pm
by Denis
Hi All,

Danilo, i use your toolbar lib.
Each Tbutton i've created have associated Tooltip from your lib.

In my app, i have an option window wich it could be open from the menu. All is Ok but when this window is open and if i put the mouse over a Tbutton (all Tbutons give this Functioning) , this window will be minimized when the ToolTip appear (the window is on the taskbar).

Did you have an idea to avoid this :?:


Denis


Here are my 2 procedures (ToolBar and option window)

Code: Select all

Procedure.b CreateToolBarMenu()

  ; return 0 if failed  Otherwise return 1
  ; voir aussi RB_INSERTBAND Message
  
  #PosXoriginePanel1 = 20 : #OffsetButtonMenu = 30
  #widthTB1 = 31*3
  #widthTB2 = #PosXoriginePanel1 + #OffsetButtonMenu + 31*3
  #widthTB3 = #PosXoriginePanel1 + #OffsetButtonMenu + 31*3 +#OffsetButtonMenu+31*2
  #widthTB4 = #PosXoriginePanel1 + #OffsetButtonMenu + 31*3 +#OffsetButtonMenu+31*2+#OffsetButtonMenu+31*5
  #widthTB5 = #PosXoriginePanel1 + #OffsetButtonMenu + 31*3 +#OffsetButtonMenu+31*2+#OffsetButtonMenu+31*5+#OffsetButtonMenu+31*3
  #PosXoriginePanel2 = #widthTB2
  #PosXoriginePanel3 = #widthTB3
  #PosXoriginePanel4 = #widthTB4
  #PosXoriginePanel5 = #widthTB5
  #PosYPanel = 6

  PanelToolBarID1=PanelGadget(#PanelGadgetToolBar1, #PosXoriginePanel1, #PosYPanel,#widthTB1 , 30)
  ClosePanelGadget()
  PanelToolBarID2=PanelGadget(#PanelGadgetToolBar2,#widthTB2 , #PosYPanel, 31*2, 30)
  ClosePanelGadget()
  PanelToolBarID3=PanelGadget(#PanelGadgetToolBar3,#widthTB3 , #PosYPanel, 31*5, 30)
  ClosePanelGadget()
  PanelToolBarID4=PanelGadget(#PanelGadgetToolBar4,#widthTB4 , #PosYPanel, 31*3, 30)
  ClosePanelGadget() 
  PanelToolBarID5=PanelGadget(#PanelGadgetToolBar5,#widthTB5 , #PosYPanel, 31, 30)
  ClosePanelGadget()

  If (PanelToolBarID1) And (CreateTB(#ToolBar1,MainWindowID,24,24)) And (PanelToolBarID2) And (CreateTB(#ToolBar2,MainWindowID,24,24)) And (PanelToolBarID3) And (CreateTB(#ToolBar3,MainWindowID,24,24)) And (PanelToolBarID4) And (CreateTB(#ToolBar4,MainWindowID,24,24)) And (PanelToolBarID5) And (CreateTB(#ToolBar5,MainWindowID,24,24))
     SetTBparent(#ToolBar1, PanelToolBarID1)
     SetWinBackgroundColor(PanelToolBarID1, $DACABD) 
     UseTB(#ToolBar1)
     SetTBimage(0,0,#TBpro_NORMAL)
     SetTBimage(0,0,#TBpro_Hot)

     AddTBsysIcons()
     AddTBbutton(#TBButtonCompress           ,#TBpro_NETDISCONNECT, #TBpro_Button)
     AddTBbutton(#TBButtonExtractFromArchive ,#TBpro_FILEOPEN,      #TBpro_Button)
     AddTBbutton(#TBButtonMakeSFX            ,#TBpro_REDO,          #TBpro_Button)
; create ToolTip for ToolBar1
     SetTBbuttonTooltip(#TBButtonCompress           , ToolTipsForToolBar(0))
     SetTBbuttonTooltip(#TBButtonExtractFromArchive , ToolTipsForToolBar(1))
     SetTBbuttonTooltip(#TBButtonMakeSFX            , ToolTipsForToolBar(2))

     UseTB(#ToolBar2)
     SetTBparent(#ToolBar2, PanelToolBarID2)
     SetWinBackgroundColor(PanelToolBarID2,$DACABD) 
     SetTBimage(0,0,#TBpro_NORMAL)
     SetTBimage(0,0,#TBpro_Hot)

     AddTBsysIcons()
     AddTBbutton(#TBButtonSchow1File ,#TBpro_PRINTPREVIEW,   #TBpro_Button)
     AddTBbutton(#TBButtonCutFile    ,#TBpro_CUT,            #TBpro_Button)
; create ToolTip for ToolBar2
     SetTBbuttonTooltip(#TBButtonSchow1File , ToolTipsForToolBar(3))
     SetTBbuttonTooltip(#TBButtonCutFile    , ToolTipsForToolBar(4))

     UseTB(#ToolBar3)
     SetTBparent(#ToolBar3, PanelToolBarID3)
     SetWinBackgroundColor(PanelToolBarID3,DACABD) 
     SetTBimage(0,0,#TBpro_NORMAL)
     SetTBimage(0,0,#TBpro_Hot)

     AddTBsysIcons()
     AddTBbutton(#TBButtonSchowIcon,  #TBpro_VIEWTREE,       #TBpro_Button)
     AddTBbutton(#TBButtonSortByName, #TBpro_SORTNAME,       #TBpro_Button)
     AddTBbutton(#TBButtonSortBySize, #TBpro_SORTSIZE,       #TBpro_Button)
     AddTBbutton(#TBButtonSortByDate, #TBpro_SORTDATE,       #TBpro_Button)
     AddTBbutton(#TBButtonSortByType, #TBpro_SORTTYPE,       #TBpro_Button)
; create ToolTip for ToolBar3
     SetTBbuttonTooltip(#TBButtonSchowIcon,  ToolTipsForToolBar(5))
     SetTBbuttonTooltip(#TBButtonSortByName, ToolTipsForToolBar(6))
     SetTBbuttonTooltip(#TBButtonSortBySize, ToolTipsForToolBar(7))
     SetTBbuttonTooltip(#TBButtonSortByDate, ToolTipsForToolBar(8))
     SetTBbuttonTooltip(#TBButtonSortByType, ToolTipsForToolBar(9))

     UseTB(#ToolBar4)
     SetTBparent(#ToolBar4, PanelToolBarID4)
     SetWinBackgroundColor(PanelToolBarID4, $DACABD) 
     SetTBimage(0,0,#TBpro_NORMAL)
     SetTBimage(0,0,#TBpro_Hot)
     SetTBimage(0,0,#TBpro_Disabled)
     AddTBsysIcons()
     AddTBbutton(#TBButtonBackArrow    , #TBpro_BACK,           #TBpro_Button)
     AddTBbutton(#TBButtonAddToFavorite, #TBpro_ADDTOFAVORITES, #TBpro_Button)
     AddTBbutton(#TBButtonOpenFolder   , #TBpro_FAVORITES,      #TBpro_Button)
; create ToolTip for ToolBar4
     SetTBbuttonTooltip(#TBButtonBackArrow    , ToolTipsForToolBar(10))
     SetTBbuttonTooltip(#TBButtonAddToFavorite, ToolTipsForToolBar(11))
     SetTBbuttonTooltip(#TBButtonOpenFolder   , ToolTipsForToolBar(12))

     UseTB(#ToolBar5)
     SetTBparent(#ToolBar5, PanelToolBarID5)
     SetWinBackgroundColor(PanelToolBarID5,$DACABD) 
     SetTBimage(0,0,#TBpro_NORMAL)
     SetTBimage(0,0,#TBpro_Hot)
     SetTBimage(0,0,#TBpro_Disabled)
     AddTBsysIcons()
     AddTBbutton(#TBButtonExit,#TBpro_DELETE,        #TBpro_DropdownButton)
; create ToolTip for ToolBar5
     SetTBbuttonTooltip(#TBButtonExit               ,ToolTipsForToolBar(13))

; Set text under groups of ToolBars
     TextGadget(#TBButtonString1 , #PosXoriginePanel1,41,#widthTB1 ,15 , FileToolbar(0),#PB_Text_Center)
     TextGadget(#TBButtonString2 , #PosXoriginePanel2,41,31*2      ,15 , FileToolbar(1),#PB_Text_Center)
     TextGadget(#TBButtonString3 , #PosXoriginePanel3,41,31*5      ,15 , FileToolbar(2),#PB_Text_Center)
     TextGadget(#TBButtonString4 , #PosXoriginePanel4,41,31*3      ,15 , FileToolbar(3),#PB_Text_Center)
     TextGadget(#TBButtonString5 , #PosXoriginePanel5,41,31*3      ,15 , FileToolbar(4))
     Result.b=1 
  Else  
     Result=0
  EndIf

  ProcedureReturn Result
  
EndProcedure 

Code: Select all

Procedure SetOptions()

  If OpenWindow(#Window_Option,345, 297, 600, 397,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_WindowCentered , "Configuration")
      WindowID1.l = WindowID(#Window_Option)

      If CreateGadgetList(WindowID(#Window_Option))
         ButtonGadget(#Button_Ok_Configuration,      30,  370, 100, 20, "Ok")
         ButtonGadget(#Button_Aide_Configuration,    480, 370, 100, 20, "Aide")
         ButtonGadget(#Button_Annuler_Configuration, 220, 370, 170, 20, "Annuler")
         PanelGadget(#Panel_Archive, 20, 20, 560, 340)
         AddGadgetItem(#Panel_Archive, -1, "Archive")
            Frame3DGadget(#Frame3D_Archive_Colonne, 18,  18, 150, 270, " Colonne ")
               TextGadget(#TextAlwaysDisplay, 28, 38, 120, 20, "Toujours afficher :", #PB_Text_Center)
               CheckBoxGadget(#AchiveUnPackSizeColumn, 38, 68, 110, 20,  "Taille")
               SetWinBackgroundColor(WindowID(#AchiveUnPackSizeColumn), #red) 
               CheckBoxGadget(#AchiveDateColumn, 38, 92, 110, 20,        "Date de mofication")
               CheckBoxGadget(#AchiveRatioColumn, 38, 116, 110, 20,      "Taux de compression")
               CheckBoxGadget(#AchivePackSizeColumn, 38, 140, 110, 20,   "Taille compressée")
               CheckBoxGadget(#AchiveAttributsColumn, 38, 164, 110, 20,  "Attributs")
               CheckBoxGadget(#AchiveCrcColumn, 38, 188, 110, 20,        "CRC")
               CheckBoxGadget(#AchivePathColumn , 38, 212, 80, 20,       "Chemin")
               CheckBoxGadget(#DisplayByDefault, 38, 248, 120, 20,         "Affichage par défaut")
               If (Pref\CompressedDisplayingOptions & %0000000001111111) = %0000000001001111 ;#DefaultCompressedDisplayingOptions 
;                 coche la boite par défaut car l'affichage des colonnes se fait par défaut
                  SetGadgetState(#DisplayByDefault,1)
;                 coche les éléments par défaut
                  SetGadgetState(#AchiveUnPackSizeColumn, 1)
                  SetGadgetState(#AchiveDateColumn,       1)
                  SetGadgetState(#AchiveRatioColumn,      1)
                  SetGadgetState(#AchivePackSizeColumn,   1)
                  SetGadgetState(#AchivePathColumn,       1)
;                 grise les éléments par défaut
                  DisableGadget(#AchiveUnPackSizeColumn, 1)
                  DisableGadget(#AchiveDateColumn,       1)
                  DisableGadget(#AchiveRatioColumn,      1)
                  DisableGadget(#AchivePackSizeColumn,   1)
                  DisableGadget(#AchiveAttributsColumn,  1)
                  DisableGadget(#AchiveCrcColumn,        1)
                  DisableGadget(#AchivePathColumn ,      1)
               Else
;                 decoche la boite par défaut
                  SetGadgetState(#DisplayByDefault,0)
;                 Affiche les éléments par défaut
                  DisableGadget(#AchiveUnPackSizeColumn, 0)
                  DisableGadget(#AchiveDateColumn,       0)
                  DisableGadget(#AchiveRatioColumn,      0)
                  DisableGadget(#AchivePackSizeColumn,   0)
                  DisableGadget(#AchiveAttributsColumn,  0)
                  DisableGadget(#AchiveCrcColumn,        0)
                  DisableGadget(#AchivePathColumn ,      0)
;                 coche les éléments selon la valeur de Pref\CompressedDisplayingOptions

; #AchiveUnPackSizeColumn_Mask = %0000000000000001
; #AchiveDateColumn_Mask       = %0000000000000010
; #AchiveRatioColumn_Mask      = %0000000000000100
; #AchivePackSizeColumn_Mask   = %0000000000001000
; #AchiveAttributsColumn_Mask  = %0000000000010000
; #AchiveCrcColumn_Mask        = %0000000000100000
; #AchivePathColumn_Mask       = %0000000001000000
; #AchiveFolderFirst_Mask      = %0000000010000000
; #AchiveBeforeFiles_Mask      = %0000000100000000
; #AchiveDontIgnoreUpCase      = %0000001000000000

                  If Pref\CompressedDisplayingOptions & #AchiveUnPackSizeColumn_Mask
                     SetGadgetState(#AchiveUnPackSizeColumn, 1)
                  EndIf

                  If Pref\CompressedDisplayingOptions & #AchiveDateColumn_Mask
                     SetGadgetState(#AchiveDateColumn, 1)
                  EndIf

                  If Pref\CompressedDisplayingOptions & #AchiveRatioColumn_Mask
                     SetGadgetState(#AchiveRatioColumn, 1)
                  EndIf
                         
                  If Pref\CompressedDisplayingOptions & #AchivePackSizeColumn_Mask
                     SetGadgetState(#AchivePackSizeColumn, 1)
                  EndIf
                         
                  If Pref\CompressedDisplayingOptions & #AchiveAttributsColumn_Mask
                     SetGadgetState(#AchiveAttributsColumn, 1)
                  EndIf
                         
                  If Pref\CompressedDisplayingOptions & #AchiveCrcColumn_Mask
                     SetGadgetState(#AchiveCrcColumn, 1)
                  EndIf
                         
                  If Pref\CompressedDisplayingOptions & #AchivePathColumn_Mask
                     SetGadgetState(#AchivePathColumn, 1)
                  EndIf
               EndIf

;            Frame3DGadget(#Frame3D_Couleur_Archive, 198, 18, 330, 170, " Affichage ")
               CheckBoxGadget(#AchiveFolderFirst, 218, 38, 300, 20, "Afficher les dossiers en premier (priorité haute)")
               CheckBoxGadget(#AchiveBeforeFiles, 218, 38+24, 300, 20, "Afficher les archives avant les fichiers")
               OptionGadget(#AchiveIgnoreUpCase, 218, 38+48, 300, 20, "Ignorer Majuscules/Minuscules pour l'affichage")
               OptionGadget(#AchiveDontIgnoreUpCase, 218, 38+48+19, 300, 20, "Tenir compte Majuscules/Minuscules pour l'affichage")
            Frame3DGadget(#Frame3D_Affichage , 198, 18, 330, 170, " Affichage ")

               If (Pref\CompressedDisplayingOptions & #AchiveFolderFirst_Mask) ; Display Folder at the top (first)
                   SetGadgetState(#AchiveFolderFirst, 1)
               Else
                   SetGadgetState(#AchiveFolderFirst, 0)
               EndIf

               If (Pref\CompressedDisplayingOptions & #AchiveBeforeFiles_Mask) ; Display Archive at the top before files
                   SetGadgetState(#AchiveBeforeFiles, 1)
               Else
                   SetGadgetState(#AchiveBeforeFiles, 0)
               EndIf

               If (Pref\CompressedDisplayingOptions & #AchiveDontIgnoreUpCase) ; Don't ignore capital letters for Files names
                   SetGadgetState(#AchiveIgnoreUpCase,     0)
                   SetGadgetState(#AchiveDontIgnoreUpCase, 1)
               Else
                   SetGadgetState(#AchiveIgnoreUpCase,     1)
                   SetGadgetState(#AchiveDontIgnoreUpCase, 0)
               EndIf

        ClosePanelGadget()
    EndIf

; Variable Pref\CompressedDisplayingOptions (word)
; Bits :  B0  : =1 : Display UnPackSize column 
; Bits :  B1  : =1 : Display FileDate column 
; Bits :  B2  : =1 : Display Ratio column 
; Bits :  B3  : =1 : Display PackSize column 
; Bits :  B4  : =1 : Display Attributs column 
; Bits :  B5  : =1 : Display CRC column 
; Bits :  B6  : =1 : Display Path column 

; By default : B0, B1, B2, B3, B6 are actived 
 
; Bits :  B7  : =1 : Display Folder at the top (first) 
; Bits :  B8  : =1 : Display Archive at the top before files
; Bits :  B9  : =1 : Don't ignore capital letters for Files names


      Repeat
         Select WaitWindowEvent()
            Case #PB_EventGadget
               Select EventGadgetID()
                  Case #DisplayByDefault
                     If GetGadgetState(#DisplayByDefault)
;                     coche la boite par défaut
                        SetGadgetState(#DisplayByDefault,1)
;                     coche les éléments par défaut
                        SetGadgetState(#AchiveUnPackSizeColumn, 1)
                        SetGadgetState(#AchiveDateColumn,       1)
                        SetGadgetState(#AchiveRatioColumn,      1)
                        SetGadgetState(#AchivePackSizeColumn,   1)
                        SetGadgetState(#AchiveAttributsColumn,  0)
                        SetGadgetState(#AchiveCrcColumn,        0)
                        SetGadgetState(#AchivePathColumn,       1)
      ;               grise les éléments par défaut
                        DisableGadget(#AchiveUnPackSizeColumn, 1)
                        DisableGadget(#AchiveDateColumn,       1)
                        DisableGadget(#AchiveRatioColumn,      1)
                        DisableGadget(#AchivePackSizeColumn,   1)
                        DisableGadget(#AchiveAttributsColumn,  1)
                        DisableGadget(#AchiveCrcColumn,        1)
                        DisableGadget(#AchivePathColumn ,      1)
                        Pref\CompressedDisplayingOptions & %1111111110000000
                        Pref\CompressedDisplayingOptions | %0000000001001111
                     Else
                        DisableGadget(#AchiveUnPackSizeColumn, 0)
                        DisableGadget(#AchiveDateColumn,       0)
                        DisableGadget(#AchiveRatioColumn,      0)
                        DisableGadget(#AchivePackSizeColumn,   0)
                        DisableGadget(#AchiveAttributsColumn,  0)
                        DisableGadget(#AchiveCrcColumn,        0)
                        DisableGadget(#AchivePathColumn ,      0)
                     EndIf

                  Case #Button_Ok_Configuration

                     If GetGadgetState(#DisplayByDefault)
                            Pref\CompressedDisplayingOptions & %1111111110000000
                            Pref\CompressedDisplayingOptions | %0000000001001111
                     Else 
                         If GetGadgetState(#AchiveUnPackSizeColumn)
                             OR Pref\CompressedDisplayingOptions, 1
;                             Pref\CompressedDisplayingOptions | %0000000000000001
                         Else
                             AND Pref\CompressedDisplayingOptions, -2
;                             Pref\CompressedDisplayingOptions & %1111111111111110
                         EndIf
                         
                         If GetGadgetState(#AchiveDateColumn)
                             OR Pref\CompressedDisplayingOptions, 2
;                             Pref\CompressedDisplayingOptions | %0000000000000010
                         Else
                             AND Pref\CompressedDisplayingOptions, -3
;                             Pref\CompressedDisplayingOptions & %1111111111111101
                         EndIf
                         
                         If GetGadgetState(#AchiveRatioColumn)
                             OR Pref\CompressedDisplayingOptions, 4
;                             Pref\CompressedDisplayingOptions | %0000000000000100
                         Else
                             AND Pref\CompressedDisplayingOptions, -5
;                             Pref\CompressedDisplayingOptions & %1111111111111011
                         EndIf
                         
                         If GetGadgetState(#AchivePackSizeColumn)
                             OR Pref\CompressedDisplayingOptions, 8
;                             Pref\CompressedDisplayingOptions | %0000000000001000
                         Else
                             AND Pref\CompressedDisplayingOptions, -9
;                             Pref\CompressedDisplayingOptions & %1111111111110111
                         EndIf
                         
                         If GetGadgetState(#AchiveAttributsColumn)
                             OR Pref\CompressedDisplayingOptions, 16
;                             Pref\CompressedDisplayingOptions | %0000000000010000
                         Else
                             AND Pref\CompressedDisplayingOptions, -17
;                             Pref\CompressedDisplayingOptions & %1111111111101111
                         EndIf
                         
                         If GetGadgetState(#AchiveCrcColumn)
                             OR Pref\CompressedDisplayingOptions, 32
;                             Pref\CompressedDisplayingOptions | %0000000000100000
                         Else
                             AND Pref\CompressedDisplayingOptions, -33
;                             Pref\CompressedDisplayingOptions & %1111111111011111
                         EndIf
                         
                         If GetGadgetState(#AchivePathColumn)
                             OR Pref\CompressedDisplayingOptions, 64
;                             Pref\CompressedDisplayingOptions | %0000000001000000
                         Else
                             AND Pref\CompressedDisplayingOptions, -65
;                             Pref\CompressedDisplayingOptions & %1111111110111111
                         EndIf
                         
                      EndIf
                      
                     If GetGadgetState(#AchiveFolderFirst)
                         OR Pref\CompressedDisplayingOptions, 128
;                         Pref\CompressedDisplayingOptions & %0000000010000000) ; Display Folder at the top (first)
                     Else
                         AND Pref\CompressedDisplayingOptions, -129
                     EndIf

                     If GetGadgetState(#AchiveBeforeFiles)
                         OR Pref\CompressedDisplayingOptions, 256
;                        Pref\CompressedDisplayingOptions & %0000000100000000) ; Display Archive at the top before files
                     Else
                         AND Pref\CompressedDisplayingOptions, -257
                     EndIf

                     If GetGadgetState(#AchiveDontIgnoreUpCase)
                         OR Pref\CompressedDisplayingOptions, 512
;                        Pref\CompressedDisplayingOptions & %0000001000000000) ; Don't ignore capital letters for Files names
                     Else
                         AND Pref\CompressedDisplayingOptions, -513
                     EndIf

                     Quit = 1
                     ; nouveau tri pour prise en compte des modifs
                     Resequence(HwndListViewCompressedFiles)
                     SendMessage_(HwndListViewCompressedFiles,#LVM_SORTITEMS,Pref\InitTextOrder,@SortListViewCompressedFiles())

                  Case #Button_Annuler_Configuration
                     CloseWindow(#Window_Option)
                     Quit = 1
               EndSelect
         EndSelect
      Until Quit = 1
      CloseWindow(#Window_Option)
   EndIf
  EndProcedure

Posted: Sat May 10, 2003 6:31 am
by Danilo
Sorry, cant test it with the 2 procedures.
For bug reports i need working bug code,
so i can test it.

Posted: Mon May 12, 2003 11:41 am
by Denis
Thank you all the same Danilo. :wink:

My code is too long to be put here.
I will try to done a small exemple and post it.


Denis

Posted: Mon May 12, 2003 4:48 pm
by Denis
Hi Danilo,

Here is a small exemple. Open the option window with the menu and put the mouse over one of the 3 TB Button and when the Tooltip appear, the option window is minimized.

Code: Select all

#ToolBar1  = 0 
#MainWindow   = 0 
#OptionWindow = 1 
#GADGET_Index = 600 
#PanelGadgetToolBar1            = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton1                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton2                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton3                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 


Procedure SetOptions() 
  If OpenWindow(#OptionWindow,0,0,250,200,#PB_Window_ScreenCentered,"Option") 
  EndIf 
  Repeat 
      Select WaitWindowEvent() 
      EndSelect 
  Until QuitOption 
EndProcedure 



If OpenWindow(#MainWindow,0,0,550,400,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Main Window") 

    If CreateMenu(0,WindowID(#MainWindow))  And CreateGadgetList(WindowID(#MainWindow)) 
       MenuTitle("Options") 
       MenuItem (100, "Configuration") 

       PanelToolBarID1=PanelGadget(#PanelGadgetToolBar1, 20, 6,93 , 30) 
       ClosePanelGadget() 
       If (PanelToolBarID1) And CreateTB(#ToolBar1,WindowID(#MainWindow),24,24) 
           SetTBparent(#ToolBar1, PanelToolBarID1) 
           SetWinBackgroundColor(PanelToolBarID1, $DACABD) 
           UseTB(#ToolBar1) 
           SetTBimage(0,0,#TBpro_NORMAL) 
           SetTBimage(0,0,#TBpro_Hot) 

           AddTBsysIcons() 
           AddTBbutton(#TBButton1 ,#TBpro_NETDISCONNECT, #TBpro_Button) 
           AddTBbutton(#TBButton2 ,#TBpro_FILEOPEN,      #TBpro_Button) 
           AddTBbutton(#TBButton3 ,#TBpro_REDO,          #TBpro_Button) 

           SetTBbuttonTooltip(#TBButton1 , "NETDISCONNECT") 
           SetTBbuttonTooltip(#TBButton2 , "FILEOPEN") 
           SetTBbuttonTooltip(#TBButton3 , "REDO") 
       EndIf 

    EndIf 

EndIf 



  Repeat 
     Select WaitWindowEvent() 
       Case  #PB_Event_Menu 
         Select EventGadgetID() 
            Case 100  ; options window 
               SetOptions() 
         EndSelect 
              
       Case #PB_EventCloseWindow 
            Quit = 1 
     EndSelect 
Until quit 

End



Denis

Posted: Mon May 12, 2003 8:38 pm
by Danilo
The Window isnt maximized, its behind the other window.
Set the relationship between windows, so the ToolWindow
is always in Front:

Code: Select all

#ToolBar1  = 0 
#MainWindow   = 0 
#OptionWindow = 1 
#GADGET_Index = 600 
#PanelGadgetToolBar1            = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton1                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton2                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 
#TBButton3                      = #GADGET_Index : #GADGET_Index = #GADGET_Index+1 

;
; by Danilo, 05.05.2003 - german forum
;
Procedure SetWindowOwner(hWnd,newOwner) ; hack - by bastel
  ProcedureReturn SetWindowLong_(hWnd,#GWL_HWNDPARENT,newOwner)
EndProcedure


Procedure SetOptions()
  If WindowID(#OptionWindow)=0
    If OpenWindow(#OptionWindow,0,0,250,200,#PB_Window_ScreenCentered,"Option") 
      SetWindowOwner(WindowID(),WindowID(#MainWindow))
    EndIf
  Else
    UseWindow(#OptionWindow)
    ActivateWindow()
  EndIf
EndProcedure 



If OpenWindow(#MainWindow,0,0,550,400,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Main Window") 

    If CreateMenu(0,WindowID(#MainWindow))  And CreateGadgetList(WindowID(#MainWindow)) 
       MenuTitle("Options") 
       MenuItem (100, "Configuration") 

       PanelToolBarID1=PanelGadget(#PanelGadgetToolBar1, 20, 6,93 , 30) 
       ClosePanelGadget() 
       If (PanelToolBarID1) And CreateTB(#ToolBar1,WindowID(#MainWindow),24,24) 
           SetTBparent(#ToolBar1, PanelToolBarID1) 
           SetWinBackgroundColor(PanelToolBarID1, $DACABD) 
           UseTB(#ToolBar1) 
           SetTBimage(0,0,#TBpro_NORMAL) 
           SetTBimage(0,0,#TBpro_Hot) 

           AddTBsysIcons() 
           AddTBbutton(#TBButton1 ,#TBpro_NETDISCONNECT, #TBpro_Button) 
           AddTBbutton(#TBButton2 ,#TBpro_FILEOPEN,      #TBpro_Button) 
           AddTBbutton(#TBButton3 ,#TBpro_REDO,          #TBpro_Button) 

           SetTBbuttonTooltip(#TBButton1 , "NETDISCONNECT") 
           SetTBbuttonTooltip(#TBButton2 , "FILEOPEN") 
           SetTBbuttonTooltip(#TBButton3 , "REDO") 
       EndIf 

    EndIf 

EndIf 



Repeat 
  Select WaitWindowEvent() 
    Case  #PB_Event_Menu 
      Select EventGadgetID() 
         Case 100  ; options window 
            SetOptions() 
      EndSelect 
    Case #PB_EventCloseWindow
      If EventWindowID() = #MainWindow
        Quit = 1
      EndIf
  EndSelect 
Until quit 

End

Posted: Tue May 13, 2003 12:58 pm
by Denis
Thanks Danilo,

with you exemple i understand the solution. :D


Denis