ToolbarHeight()???

Für allgemeine Fragen zur Programmierung mit PureBasic.
Miao
Beiträge: 25
Registriert: 09.09.2004 10:22

ToolbarHeight()???

Beitrag 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!
Benutzeravatar
Andre
PureBasic Team
Beiträge: 1765
Registriert: 11.09.2004 16:35
Computerausstattung: MacBook Core2Duo mit MacOS 10.6.8
Lenovo Y50 i7 mit Windows 10
Wohnort: Saxony / Deutscheinsiedel
Kontaktdaten:

Beitrag 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
Bye,
...André
(PureBasicTeam::Docs - PureArea.net | Bestellen:: PureBasic | PureVisionXP)
Miao
Beiträge: 25
Registriert: 09.09.2004 10:22

Beitrag von Miao »

ich danke dir herzlichst!! :)
Benutzeravatar
Esquilin7
Beiträge: 13
Registriert: 15.11.2004 16:17
Wohnort: Wien
Kontaktdaten:

Beitrag 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:
Lg Esquilin7
Benutzeravatar
nicolaus
Moderator
Beiträge: 1175
Registriert: 11.09.2004 13:09
Kontaktdaten:

Beitrag 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
Antworten