Scroll bars and ListIcon's

Just starting out? Need help? Post your questions and find answers here.
lee__48
User
User
Posts: 21
Joined: Thu Dec 08, 2005 3:17 am
Location: UK

Scroll bars and ListIcon's

Post 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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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
I may look like a mule, but I'm not a complete ass.
lee__48
User
User
Posts: 21
Joined: Thu Dec 08, 2005 3:17 am
Location: UK

Post 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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

You're welcome.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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
lee__48
User
User
Posts: 21
Joined: Thu Dec 08, 2005 3:17 am
Location: UK

Post 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
Post Reply