Bring combobox visible in ListiconGadget?
Posted: Thu Sep 22, 2005 9:39 am
I'm trying to click on a cell in a ListiconGadget and have a ComboBoxGadget embed itself in that cell. When I select an item from the ComboBox, it should vanish, returning the data to that cell.
Problem 1. Not understanding API, I am having trouble getting the combobox to appear exactly where I want it to.
Problem 2. Since it's sitting on top of the list when it appears, it vanishes partly behind the gadget when I click on it.
Problem 3. The height of the cell is smaller than the height of a combobox and the combobox cannot be resized any smaller than the default.
I'm out of my depth here. Could someone have a look at this for me?
I've put extraneous junk in here while I was testing because I really don't know what I am doing here!!!
Problem 1. Not understanding API, I am having trouble getting the combobox to appear exactly where I want it to.
Problem 2. Since it's sitting on top of the list when it appears, it vanishes partly behind the gadget when I click on it.
Problem 3. The height of the cell is smaller than the height of a combobox and the combobox cannot be resized any smaller than the default.
I'm out of my depth here. Could someone have a look at this for me?
Code: Select all
;============================================================================================================================
;
;============================================================================================================================
Global BubbleTipStyle.l
;============================================================================================================================
;
;============================================================================================================================
BubbleTipStyle = 0
Enumeration 1
#Window_hittest
EndEnumeration
#WindowIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#Gadget_hittest_fmain
#Gadget_hittest_ListIcon3
#Gadget_hittest_hitcombo
EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue
Procedure.l Window_hittest()
If OpenWindow(#Window_hittest,64,73,640,480,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Column hit test")
If CreateGadgetList(WindowID(#Window_hittest))
Frame3DGadget(#Gadget_hittest_fmain,5,0,630,475,"")
ListIconGadget(#Gadget_hittest_ListIcon3,15,15,610,450,"Column 1",292,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#Gadget_hittest_ListIcon3,1,"Column 2",292)
ComboBoxGadget(#Gadget_hittest_hitcombo,0,0,80,200)
HideGadget(#Gadget_hittest_hitcombo,1)
HideWindow(#Window_hittest,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
If Window_hittest()
For flooble = 0 To 10
AddGadgetItem(#Gadget_hittest_ListIcon3, -1, "column 1" + Chr(10) + "column 2", 0)
Next flooble
For flooble = 0 To 10
AddGadgetItem(#Gadget_hittest_hitcombo, -1, "Macaroni " + Str(flooble), 0)
Next flooble
quithittest = 0
Repeat
EventID = WaitWindowEvent()
MenuID = EventMenuID()
GadgetID = EventGadgetID()
WindowID = EventWindowID()
Select EventID
Case #PB_Event_CloseWindow
If WindowID = #Window_hittest
quithittest = 1
EndIf
Case #PB_Event_Gadget
Select GadgetID
Case #Gadget_hittest_ListIcon3
Select EventType()
Case #PB_EventType_LeftDoubleClick : Gosub TestColumn
Case #PB_EventType_RightDoubleClick
Case #PB_EventType_RightClick
Default
EndSelect
Case #Gadget_hittest_hitcombo : Gosub GetCombo
EndSelect
EndSelect
Until quithittest
CloseWindow(#Window_hittest)
EndIf
End
TestColumn:
;MessageRequester("Here we are:", "List event fired", #PB_MessageRequester_Ok )
temp.POINT
GetCursorPos_(temp)
MapWindowPoints_(0, GadgetID(#Gadget_hittest_ListIcon3), temp, 1)
; SendMessage_(GadgetID(#Gadget_hittest_ListIcon3), #LVM_GETITEMPOSITION, itemNumber , pItem) ; get item position
;Column = Round(temp\x / 292 + 1, 0)
;Row = Round(temp\y / 18 + 1, 0)
Debug Str(Column) + " -- " + Str(Row)
ResizeGadget(#Gadget_hittest_hitcombo, temp\x/292+1, temp\y/18+1, 292, 18)
HideGadget(#Gadget_hittest_hitcombo, 0)
Return
GetCombo:
If EventType() = #PB_EventType_RightClick
HideGadget(#Gadget_hittest_hitcombo, 1)
EndIf
Return