Page 1 of 1

explorer like task bar?

Posted: Sat Sep 10, 2005 8:45 am
by lexvictory
i was wondering if it is possible to get a control (or gadget) like explorer's task bar (the bit where the open windows are displayed), cos im looking to make my own shell and i was wondering if this is possible in purebasic (the taskbar bit).

Posted: Sat Sep 10, 2005 4:10 pm
by PrincieD
hi lexvictory,

As far as i'm aware the taskbar is simply a rebar control with its own custom handling code and bitmaps instead of the default rebar skin. If you want to wait until my ProGUI library is released you should be able to achieve what you desire relatively easyly :)

Posted: Sun Sep 11, 2005 12:57 pm
by lexvictory
this might seem a wierd sort of question but wat exactly is a rebar?
and does anyone know how geoshell does this sort of thing with its taskbar?

Posted: Sun Sep 11, 2005 3:34 pm
by PrincieD
A rebar is a type of container control, you can put any control into a rebar and the rebar allows you to re-arrange the layout and automatically resizes the contained controls. Plus the rebar has a nice gradient background, you can see this in the toolbar of windows explorer, internet explorer and firefox (to name a few).

Posted: Mon Sep 12, 2005 10:15 am
by lexvictory
does anyone know how to make a rebar in purebasic?

Posted: Tue Sep 13, 2005 6:19 am
by lexvictory
silly me, i should have searched my documentation b4 asking if anyone knew how to make one.....
ill post the code i have so far later today, wen i get home..... :lol:
cos i got some of it working, jsut the resizing bit and the position of the gadgets.... work well apart from that...

Posted: Tue Sep 13, 2005 12:47 pm
by lexvictory
heres the code from sdk documentation:

Code: Select all

HWND WINAPI CreateRebar(HWND hwndOwner)
{
   REBARINFO     rbi;
   REBARBANDINFO rbBand;
   RECT          rc;
   HWND   hwndCB, hwndTB, hwndRB;
   DWORD  dwBtnSize;
   INITCOMMONCONTROLSEX icex;
   
   icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icex.dwICC   = ICC_COOL_CLASSES|ICC_BAR_CLASSES;
   InitCommonControlsEx(&icex);
   hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW,
                           REBARCLASSNAME,
                           NULL,
                           WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
                           WS_CLIPCHILDREN|RBS_VARHEIGHT|
                           CCS_NODIVIDER,
                           0,0,0,0,
                           hwndOwner,
                           NULL,
                           g_hinst,
                           NULL);
   if(!hwndRB)
      return NULL;
   // Initialize and send the REBARINFO structure.
   rbi.cbSize = sizeof(REBARINFO);  // Required when using this
                                    // structure.
   rbi.fMask  = 0;
   rbi.himl   = (HIMAGELIST)NULL;
   if(!SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi))
      return NULL;
   // Initialize structure members that both bands will share.
   rbBand.cbSize = sizeof(REBARBANDINFO);  // Required
   rbBand.fMask  = RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | 
                   RBBIM_STYLE | RBBIM_CHILD  | RBBIM_CHILDSIZE | 
                   RBBIM_SIZE;
   rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDBMP;
   rbBand.hbmBack = LoadBitmap(g_hinst,
                              MAKEINTRESOURCE(IDB_BACKGRND));   
   // Create the combo box control to be added.
   hwndCB = CreateComboBox(hwndRB);
   // Set values unique to the band with the combo box.
   GetWindowRect(hwndCB, &rc);
   rbBand.lpText     = "Combo Box";
   rbBand.hwndChild  = hwndCB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = rc.bottom - rc.top;
   rbBand.cx         = 200;
   
   // Add the band that has the combo box.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   
   // Create the toolbar control to be added.
   hwndTB = CreateToolbar(hwndOwner, dwStyle);
   
   // Get the height of the toolbar.
   dwBtnSize = SendMessage(hwndTB, TB_GETBUTTONSIZE, 0,0);

   // Set values unique to the band with the toolbar.
   rbBand.lpText     = "Tool Bar";
   rbBand.hwndChild  = hwndTB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = HIWORD(dwBtnSize);
   rbBand.cx         = 250;

   // Add the band that has the toolbar.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   return (hwndRB);
}

and heres my code:

Code: Select all

If OpenWindow(0,100,100,500,200,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget, "rebar test")
  
  rbi.REBARINFO
  rbband.REBARBANDINFO
  rc.RECT
  hwndCB.l
  hwndTB.l
  hwndRB.l
  dwBtnSize.w
  icex.INITCOMMONCONTROLSEX
  
  icex\dwSize = SizeOf(INITCOMMONCONTROLSEX);
   icex\dwICC   = #ICC_COOL_CLASSES|#ICC_BAR_CLASSES
   InitCommonControlsEx_(@icex)
   hwndRB = CreateWindowEx_(#WS_EX_TOOLWINDOW, "ReBarWindow32",NULL,#WS_CHILD|#WS_VISIBLE|#WS_CLIPSIBLINGS|#WS_CLIPCHILDREN|#RBS_VARHEIGHT|#CCS_NODIVIDER,0,0,0,0,WindowID(),NULL,GetModuleHandle_(null),NULL)
   
   
   If hwndrb = 0
    errormsg("create rebar")
    End
   EndIf
   
   ;// Initialize And send the REBARINFO Structure.
   rbi\cbSize = SizeOf(REBARINFO)   ;// Required when using this
                                    ;// Structure.
   rbi\fMask  = 0
   rbi\himl   = NULL
   If SendMessage_(hwndRB, #RB_SETBARINFO, 0, @rbi) = 0
    errormsg("send rbi")
    End
   EndIf
   
   ;// Initialize Structure members that both bands will share.
   rbBand\cbSize = SizeOf(REBARBANDINFO);  // Required
   rbBand\fMask  = #RBBIM_COLORS | #RBBIM_TEXT | #RBBIM_BACKGROUND |#RBBIM_STYLE | #RBBIM_CHILD  | #RBBIM_CHILDSIZE |#RBBIM_SIZE
   rbBand\fStyle = #RBBS_CHILDEDGE | #RBBS_FIXEDBMP;
   ;rbBand\hbmBack = LoadBitmap(GetModuleHandle_(0), MAKEINTRESOURCE(#IDB_BACKGRND))   
   
   CreateGadgetList(hwndrb)
   ComboBoxGadget(2, 0,0,100,20)
   AddGadgetItem(2, -1, "uno")
   ;// Create the combo box control To be added.
   hwndCB = GadgetID(2)
   ;// Set values unique To the band with the combo box.
   GetWindowRect_(hwndCB, @rc)
   rbBand\lpText     = @"Combo Box"
   rbBand\hwndChild  = hwndCB
   rbBand\cxMinChild = 0
   rbBand\cyMinChild = rc\bottom - rc\top
   rbBand\cx         = 200
   
   ;// Add the band that has the combo box.
   SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
   
   ComboBoxGadget(3, 250,0,100,20)
   AddGadgetItem(3, -1, "due")
   ;// Create the combo box control To be added.
   hwndCB2 = GadgetID(3)
   ;// Set values unique To the band with the combo box.
   GetWindowRect_(hwndCB2, @rc)
   rbBand\lpText     = @"Combo Box"
   rbBand\hwndChild  = hwndCB
   rbBand\cxMinChild = 0
   rbBand\cyMinChild = rc\bottom - rc\top
   rbBand\cx         = 250
   
   ;// Add the band that has the combo box.
   SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
   
;{ following bit dont work, couldnt get it to compile!   
;// Create the toolbar control To be added.
   ;hwndTB = CreateToolbar_(0, WindowID())
   
   ;// Get the height of the toolbar.
   ;dwBtnSize = SendMessage_(hwndTB, #TB_GETBUTTONSIZE, 0,0)
   
   ;// Set values unique To the band with the toolbar.
   ;rbBand\lpText     = "Tool Bar"
   ;rbBand\hwndChild  = hwndTB
   ;rbBand\cxMinChild = 0
   ;rbBand\cyMinChild = HIWORD(dwBtnSize)
   ;rbBand\cx         = 250

   ;// Add the band that has the toolbar.
   ;SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
;}
   
  Repeat
    event = WaitWindowEvent()
    If event = #PB_Event_CloseWindow
      quit = 1
    ElseIf event = #PB_Event_SizeWindow
      MoveWindow_(hwndrb, 0,0,WindowWidth(), 30, #True)
    EndIf
  Until quit = 1




EndIf
if u take out the bit with the 2nd combo gadget, it works fine..... (resizing window width)

Posted: Tue Sep 13, 2005 8:51 pm
by Henrik
Hi
Check out Sparkie's example at this link:

viewtopic.php?t=11802&postdays=0&postor ... er&start=0


Best Regrads
Henrik.

Posted: Wed Sep 14, 2005 2:10 am
by lexvictory
that dont help me, ive managed to create it, but when i resize or move the bands around, the gadgets dont move with it