Page 1 of 2

Posted: Thu Mar 15, 2007 2:29 am
by srod
Holy slow coach, beaten by the deadly duo; batman + netmaestro yet again!

:)

Oh well, I'll post what I hacked up anyhow:

Code: Select all

#LVM_GETHEADER = #LVM_FIRST+31

Procedure.l callback(hWnd, uMsg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case #WM_NOTIFY
      *nmh.NMHDR=lParam
        Select *nmh\code
          Case #NM_RCLICK
             If *nmh\hwndFrom = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0)
               ;Now identify which item was clicked.
                GetCursorPos_(hdhittest.HD_HITTESTINFO\pt) 
                ScreenToClient_(*nmh\hwndFrom, hdhittest\pt) 
                SendMessage_(*nmh\hwndFrom, #HDM_HITTEST, 0, @hdhittest)
                Debug "Clicked header item " + Str(hdhittest\iItem)
             EndIf
        EndSelect
  EndSelect
  ProcedureReturn result
EndProcedure

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(0))
    ListIconGadget(0, 5, 5, 290, 90, "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")
    SetWindowCallback(@callback())
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf
EndIf
@Joakim Christiansen: to alleviate your AddGadgetItem() woes, you could simply use AddGadgetItem() with an empty string and then set individual cells with SetGadgetItemText() etc. This might be slightly less problematic.

Posted: Thu Mar 15, 2007 2:43 am
by Sparkie
srod wrote:Holy slow coach, beaten by batman yet again!
It's been a while since anyone has beaten the Great ListIconGadgetGuru named srod. 8)

I figure you must have been taking a little snooze...zzzzzzz :P

Posted: Thu Mar 15, 2007 2:46 am
by netmaestro
It's well posted anyway as srod and I chose different avenues to achieve the rightclick test.

Posted: Thu Mar 15, 2007 2:50 am
by srod
No time for sleep... must work... must debug spahgetti code... must co... zzzzzz!

Actually, I realised after I posted that it was netmaestro who had already produced code to solve the problem I was working on. Must have got your avatars mixed up somehow!

I was getting to the set column order array, but was way too slow for that one! :)

Posted: Thu Mar 15, 2007 2:57 am
by Sparkie
Hey srod...I want to swap rankings with you...here's my PureBasic Expert which you have more than earned. Now if you will kindly hand over your Addict ranking I'll be on my way. :)

Posted: Thu Mar 15, 2007 2:59 am
by netmaestro
grrr... Mitts off mine, it hasn't had time to get dusty yet!

Posted: Thu Mar 15, 2007 3:10 am
by Sparkie
Not to worry netmaestro. Yours suits you just fine. Mine just doesn't feel right. I don't know.... maybe it's the weight I gained since I quit smoking 8)

Posted: Thu Mar 15, 2007 3:10 am
by srod
Sparkie wrote:Hey srod...I want to swap rankings with you...here's my PureBasic Expert which you have more than earned. Now if you will kindly hand over your Addict ranking I'll be on my way. :)
Are you kidding man? :) Your knowledge of api stuff far outweigh's mine and on a technical level, some of your posts are beyond reproach. Beside's one of my posts in the bug section this week warrants that I get busted back down to 'Novice' at best! :wink: No, in as much as the rankings are pretty meaningless, you two are the real experts here. I just don't have a great deal of time at the moment to help out in the forums as I once did.

No, I could list half a dozen users who should be elevated way before myself - and there are undoubtedly many more.

Now, how about we swap bank accounts instead? :D

Posted: Thu Mar 15, 2007 3:14 am
by Sparkie
srod wrote:Now, how about we swap bank accounts instead?
Two weeks ago maybe I'd have said yes....but now that I have deposited my tax refund check...hmmmm....I don't think so my friend :P

Posted: Thu Mar 15, 2007 3:17 am
by Sparkie
srod wrote:Beside's one of my posts in the bug section this week warrants that I get busted back down to 'Novice' at best!
Done that once or twice myself. No need for :oops: as it just shows that we are human just like everyone else :wink:

Posted: Thu Mar 15, 2007 3:18 am
by srod
Not even if I throw my 'Addict' ranking in for free?

Oh well, worth a try!

:)

Posted: Thu Mar 15, 2007 3:20 am
by Fangbeast
Done that once or twice myself. No need for :oops: as it just shows that we are human just like everyone else
Human?? We have a frog, a bat, a homer simpsons character and a visiting fanged beast in the room!!

Posted: Thu Mar 15, 2007 3:22 am
by srod
Oy, cut that out!

It's not my fault I look like comic book guy - and that's on a good day! :)

Posted: Thu Mar 15, 2007 3:25 am
by Sparkie
Hey Fangles, isn't it about time you updated your avatar :?: Let's get a peek at those infamous fangs of yours :lol:

Posted: Thu Mar 15, 2007 10:15 am
by Derek
Fangbeast wrote:
Done that once or twice myself. No need for :oops: as it just shows that we are human just like everyone else
Human?? We have a frog, a bat, a homer simpsons character and a visiting fanged beast in the room!!
And now a robot comes to the party.