Seite 1 von 1

ToolbarHeight()???

Verfasst: 22.11.2004 23:24
von Miao
Mahlzeit :)

ich stelle fest daß es den Befehl nicht gibt und ich ihn aber unbedingt brauche. Weiß jemand eine Alternative? API?

Vielen Dank schonmal!

Verfasst: 23.11.2004 00:10
von Andre
Im folgenden umfangreichen Code-Beispiel (aus dem engl. Forum, gibt's im nächsten CodeArchiv) werden diversen Angaben zu ToolBar und anderen Dingen angezeigt.
In der vierten Zeile des ListIcon steht in der letzten Spalte die ToolBar-Höhe... :wink:

Code: Alles auswählen

Enumeration 
  #Window_0 
EndEnumeration 

Enumeration 
  #ListIcon_0 
EndEnumeration 

Enumeration 
  #MenuBar_0 
  #ToolBar_0 
EndEnumeration 

Enumeration 
  #StatusBar_0 
EndEnumeration 

#TB_GETRECT = (#WM_USER + 51) 
#TB_GETMAXSIZE = (#WM_USER + 83) 

Declare getinfo(htb.l) 
Global hToolBar 

Procedure MyWindowCallBack(hwnd, msg, wParam, lParam) 
  
  result = #PB_ProcessPureBasicEvents 
  Select msg 
    
    Case #WM_MOVE 
      getinfo(hToolBar) 
    
  EndSelect 
  
  ProcedureReturn result 
EndProcedure 

Procedure getinfo(htb.l) 
  GetWindowRect_(htb, @tbarW.RECT) 
  GetClientRect_(htb, @tbarC.RECT) 
  
  ;- get rect for item 0 (all other toolbar items are the same size?) 
  SendMessage_(htb, #TB_GETRECT, 0, @tbInfo.RECT) 
  SendMessage_(htb, #TB_GETMAXSIZE, 0, @tbSize.SIZE) 
  
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\left), 1) 
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\right), 2) 
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\right - tbarW\left), 3) 
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\top), 4) 
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\bottom), 5) 
  SetGadgetItemText(#ListIcon_0, 0, Str(tbarW\bottom - tbarW\top), 6) 
  
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\left), 1) 
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\right), 2) 
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\right - tbarC\left), 3) 
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\top), 4) 
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\bottom), 5) 
  SetGadgetItemText(#ListIcon_0, 1, Str(tbarC\bottom - tbarC\top), 6) 
  
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\left), 1) 
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\right), 2) 
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\right - tbInfo\left), 3) 
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\top), 4) 
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\bottom), 5) 
  SetGadgetItemText(#ListIcon_0, 2, Str(tbInfo\bottom - tbInfo\top), 6) 
    
  SetGadgetItemText(#ListIcon_0, 3, Str(tbSize\cx), 3) 
  SetGadgetItemText(#ListIcon_0, 3, Str(tbSize\cy), 6) 
EndProcedure 

If OpenWindow(#Window_0, 0, 0, 600, 260,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_TitleBar , "Test Info") 
  
  If CreateMenu(#MenuBar_0, WindowID()) 
    MenuTitle("Test") 
  EndIf 
  
  If CreateGadgetList(WindowID()) 
    ListIconGadget(#ListIcon_0, 10, 70, 580, 100, "Item", 175, #PB_ListIcon_FullRowSelect) 
    AddGadgetColumn(#ListIcon_0, 1, "Left pos", 70) 
    AddGadgetColumn(#ListIcon_0, 2, "Right pos", 70) 
    AddGadgetColumn(#ListIcon_0, 3, "Width", 60) 
    AddGadgetColumn(#ListIcon_0, 4, "Top pos", 70) 
    AddGadgetColumn(#ListIcon_0, 5, "Bottom pos", 70) 
    AddGadgetColumn(#ListIcon_0, 6, "Height", 60) 
    
    AddGadgetItem(#ListIcon_0, -1, "Toolbar GetWindowRect_()") 
    AddGadgetItem(#ListIcon_0, -1, "Toolbar GetClientRect_()") 
    AddGadgetItem(#ListIcon_0, -1, "First Toolbar Item #TB_GETRECT") 
    AddGadgetItem(#ListIcon_0, -1, "Toolbar #TB_GETMAXSIZE") 
  EndIf 
  
  hToolBar =  CreateToolBar(#ToolBar_0, WindowID()) 
  ToolBarStandardButton(0, #PB_ToolBarIcon_New) 
  ToolBarStandardButton(1, #PB_ToolBarIcon_Open) 
  ToolBarStandardButton(2, #PB_ToolBarIcon_Save) 
  ToolBarStandardButton(3, #PB_ToolBarIcon_Print) 
  ToolBarStandardButton(1, #PB_ToolBarIcon_Help) 
    
  CreateStatusBar(#StatusBar_0, WindowID()) 
  AddStatusBarField(200) 
  AddStatusBarField(400) 
  StatusBarText(#StatusBar_0, 0, "Field0") 
  StatusBarText(#StatusBar_0, 1, "Field1") 
  getinfo(hToolBar) 
  SetWindowCallback(@MyWindowCallBack()) 
EndIf 

Repeat 
  
  event = WaitWindowEvent() 
  
Until event = #PB_EventCloseWindow 

End

Verfasst: 24.11.2004 09:40
von Miao
ich danke dir herzlichst!! :)

Verfasst: 07.12.2004 15:18
von Esquilin7
Heißt so viel wie "Die höhe der ToolBar ist 22" :D
Ist doch immer gleich, oder?
MAN BIN ICH GUT :lol:

Verfasst: 07.12.2004 18:19
von nicolaus
wenn ihr auf purearea.net mal im showcase schaut gibts da auch ne lib von mir die die unetr anderem die höhe der toolbar zurück gibt. ist unter dem namen CN_tools zu finden