ListIconGadget row height and scrollbar
ListIconGadget row height and scrollbar
Can anyone tell me how to get current ListIconGadget row height in pixels and if the ListIconGadget columns are bigger than ListIconGadget size, how i know how much the horizontal scroll bar is moved
Thanks
Karu
Thanks
Karu
Re: ListIconGadget row height and scrollbar
The following will return the height of the first row so it will only work if the listicon has at least one row :
Code: Select all
rc.rect\left = #LVIR_BOUNDS
SendMessage_(GadgetID(0), #LVM_GETITEMRECT, 0, rc)
height = rc\bottom - rc\top + 1
I may look like a mule, but I'm not a complete ass.
Re: ListIconGadget row height and scrollbar
srod wrote:The following will return the height of the first row so it will only work if the listicon has at least one row :
Code: Select all
rc.rect\left = #LVIR_BOUNDS SendMessage_(GadgetID(0), #LVM_GETITEMRECT, 0, rc) height = rc\bottom - rc\top + 1

Re: ListIconGadget row height and scrollbar
Ok, one problem solved but does anyone have idea how to detect column vertical position in listicongadget when horizontal scrollbar is moved?
Re: ListIconGadget row height and scrollbar
Not quite sure what you mean?
I may look like a mule, but I'm not a complete ass.
Re: ListIconGadget row height and scrollbar
Ok, i try to explain although my english skills are not good.
I make editable listbox in way where i detect row and column where mouse clicked, then measure the x,y of the editable cell, then put a textbox on its place and disable listbox. Now if the total width of colums are bigger that listbox size, there in listbox will be horizontal scrollbar. Now if i move scrollbar, the x of the editable cell is wrong.
I make editable listbox in way where i detect row and column where mouse clicked, then measure the x,y of the editable cell, then put a textbox on its place and disable listbox. Now if the total width of colums are bigger that listbox size, there in listbox will be horizontal scrollbar. Now if i move scrollbar, the x of the editable cell is wrong.

Re: ListIconGadget row height and scrollbar
You want to know how much trouble that kind of thing gave me when I was creating EsGRID?
What I ended up doing was removing the edit control whenever the user begins a scroll action and then I reinstate it when the scrolling is complete. All other solutions generated too much flicker or other problems!
Hang on a cotton picking minute... how can the user scroll the listicon if you have disabled it?

What I ended up doing was removing the edit control whenever the user begins a scroll action and then I reinstate it when the scrolling is complete. All other solutions generated too much flicker or other problems!

Hang on a cotton picking minute... how can the user scroll the listicon if you have disabled it?
I may look like a mule, but I'm not a complete ass.
Re: ListIconGadget row height and scrollbar
User can't scroll in the time when 'editing mode' is active, no need for that because all changes in textbox are immediately will be written to listbox cell and all other actions with listbox just cancel editing mode and hide textbox.srod wrote:Hang on a cotton picking minute... how can the user scroll the listicon if you have disabled it?
Only problem is horizontal scrollbar position.

Re: ListIconGadget row height and scrollbar
I am still puzzled.
Because you disable the listicon when the edit box is visible, the user cannot scroll. If the user scrolls when the edit box is not visible then, well, I don't understand the problem? You just reposition the edit box when the user clicks a cell etc.
Or are you simply after a method for determining the exact bounds of any given cell in the listicon and/or a notification of which cell was clicked etc? If so, then why didn't you say so?
That is easy.
I am just struggling to understand why you would want the scroll position because, well, take it from an experienced creator of grid controls, such info is not required for what I am guessing you are really after, not when dealing with ListIcons anyhow.
Because you disable the listicon when the edit box is visible, the user cannot scroll. If the user scrolls when the edit box is not visible then, well, I don't understand the problem? You just reposition the edit box when the user clicks a cell etc.
Or are you simply after a method for determining the exact bounds of any given cell in the listicon and/or a notification of which cell was clicked etc? If so, then why didn't you say so?

I am just struggling to understand why you would want the scroll position because, well, take it from an experienced creator of grid controls, such info is not required for what I am guessing you are really after, not when dealing with ListIcons anyhow.
I may look like a mule, but I'm not a complete ass.
Re: ListIconGadget row height and scrollbar
Code: Select all
Dim colp.l(4)
OpenWindow(0,0,0,200,300,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered |#PB_Window_MinimizeGadget)
ListIconGadget(0,0,0,198,300,"Column 0",60,#PB_ListIcon_GridLines| #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(0, 1, "Column 1", 70)
AddGadgetColumn(0, 2, "Column 2", 80)
AddGadgetColumn(0, 2, "Column 3", 90)
For a = 0 To 3
colp(a) = GetGadgetItemAttribute(0, 0, #PB_ListIcon_ColumnWidth, a)
Next
;example column nr 2 position X to place textbox i can calculate
textboxXposition = WindowMouseX(0) - listboxiX + colp(0) + colp(1); + bordersize
Debug textboxXposition
For i=0 To 10
AddGadgetItem(0, -1, "line "+Str(i)+" col 0"+Chr(10)+"line "+Str(i)+" col 1"+Chr(10)+"line "+Str(i)+" col 2"+Chr(10)+"line "+Str(i)+" col 3")
Next
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Re: ListIconGadget row height and scrollbar
Honestly, if you are wishing to position a string gadget over a cell then your approach is too simplistic. Sure you can get the required scroll amount by using the GetScrollInfo_() function etc. but what happens when/if the user resizes a column or, heaven forbid, drags a column and reorders them? You are going to give yourself a migraine followed by a hernia followed by a nightmare!
Instead I advise you take a good look at the following messages. The first can be used to locate the cell which has just been clicked (if you use it in response to a #WM_LBUTTONDOWN message etc.) and the second can be used to get the exact bounds/dimensions of a cell. This second message takes all of the the scrolling into account.

**EDIT : I do have a simple utility which allows you to edit the cells in a ListIcon gadget (Windows only) if it would be of any use? It's a bit of a cheat but it does work.

Instead I advise you take a good look at the following messages. The first can be used to locate the cell which has just been clicked (if you use it in response to a #WM_LBUTTONDOWN message etc.) and the second can be used to get the exact bounds/dimensions of a cell. This second message takes all of the the scrolling into account.
- #LVM_SUBITEMHITTEST
- #LVM_GETSUBITEMRECT

**EDIT : I do have a simple utility which allows you to edit the cells in a ListIcon gadget (Windows only) if it would be of any use? It's a bit of a cheat but it does work.
I may look like a mule, but I'm not a complete ass.
Re: ListIconGadget row height and scrollbar
As right now i work 99% in cgi and php, the api is not my strongest side, can you give me example please, thankssrod wrote:Honestly, if you are wishing to position a string gadget over a cell then your approach is too simplistic. Sure you can get the required scroll amount by using the GetScrollInfo_() function etc. but what happens when/if the user resizes a column or, heaven forbid, drags a column and reorders them? You are going to give yourself a migraine followed by a hernia followed by a nightmare!![]()
Instead I advise you take a good look at the following messages. The first can be used to locate the cell which has just been clicked (if you use it in response to a #WM_LBUTTONDOWN message etc.) and the second can be used to get the exact bounds/dimensions of a cell. This second message takes all of the the scrolling into account.
If you are attempting to create a grid control then, take it from me, it would be far easier to start one from scratch and use a custom window's class rather than base it upon a ListIcon gadget. The ListIcon (or more precisely a Windows ListView control) comes with too much baggage and too many subtle problems which need solving, particularly scrolling and painting problems. It was, in my own words, a bloody nightmare!
- #LVM_SUBITEMHITTEST
- #LVM_GETSUBITEMRECT
**EDIT : I do have a simple utility which allows you to edit the cells in a ListIcon gadget (Windows only) if it would be of any use? It's a bit of a cheat but it does work.
Re: ListIconGadget row height and scrollbar
Sorry, but I haven't time.
Just search on those messages in these forums and should find something useful. Failing that, try Google.
Just search on those messages in these forums and should find something useful. Failing that, try Google.
I may look like a mule, but I'm not a complete ass.