Page 1 of 1

Scroll bars and ListIcon's

Posted: Wed May 17, 2006 1:39 pm
by lee__48
Hi all,

Is it possible to make your window's scroll bars a larger (or smaller) without adjusting the display settings. I am trying to write a program with a touch screen interface so could do with larger buttons to push!

Also, is it possible to initiate an event by pressing the column headers on a listicon gadget? I need to redraw the table from an SQLite query!

Thanks in advance,
Lee

Posted: Wed May 17, 2006 6:36 pm
by srod
I don't know about your first question, but the following reports which header item is clicked etc.

Code: Select all

;The HDN_ITEMCLICK notification message notifies a header control's parent window (i.e. the
;ListIcon in this case) that the user clicked the control. This notification message is 
;sent in the form of a #WM_NOTIFY message.

Global oldListProc

Procedure.l listproc(hwnd, uMsg, wParam, lParam) 
  Protected result, *phdr.HD_NOTIFY
  result=CallWindowProc_(oldListProc, hwnd, uMsg, wParam, lParam)
  Select uMsg
    Case #WM_NOTIFY  
    *phdr=lParam
    If *phdr\hdr\code=#HDN_ITEMCLICK
      Debug "Header item " + Str(*phdr\iItem) + " clicked."
    EndIf
  EndSelect
  ProcedureReturn result
EndProcedure

If OpenWindow(0, 100, 100, 500, 500, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   If CreateGadgetList(WindowID(0))
     ListIconGadget(0, 5, 5, 400, 400, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
     AddGadgetColumn(0, 1, "Address", 250)
     AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
     AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
;Subclass the ListIcon.
  oldListProc = SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @listproc()) 
     Repeat
       Event = WaitWindowEvent()
     Until Event = #PB_Event_CloseWindow
   EndIf
 EndIf

Posted: Thu May 18, 2006 10:14 pm
by lee__48
Thanks again srod, you seem to be answering all my questions recently! The code works a treat - thanks :)

I spent ages searching the internet for sample code to adjust the size of a scroll bar. Couldn't find anything I could understand and adapt. I'll have to make a custom one or think of another way!! Never mind.

Lee

Posted: Thu May 18, 2006 11:23 pm
by srod
You're welcome.

Posted: Thu May 18, 2006 11:30 pm
by srod
As for changing the ListIcon's scroll-bars, I wouldn't have thought it was possible as their dimensions are governed by certain system settings (e.g. #SM_CXVSCROLL etc.) Changing these values (if it is even possible) would affect every window with standard scroll-bars.

Posted: Fri May 19, 2006 3:51 pm
by Trond
You can use a ScrollBarGadget() to make your own scrollbar. It's not perfect, but it's better than nothing.

Code: Select all

If OpenWindow(0, 0, 0, 300, 400, "ScrollBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
  ScrollBarGadget  (0, 240, 10,  50, 380 ,0, 300, 50, #PB_ScrollBar_Vertical)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Posted: Sat May 20, 2006 12:43 am
by lee__48
Is there any way to get the UP and DOWN buttons taller? I think I'll have to have two big standard image buttons instead of a scroll bar.

Lee