Re: [Win32Lib] ComboBox drop-down doesn't move with window
- Posted by Judith Evans <camping at txcyber.com> Jan 30, 2003
- 444 views
Hi Dan, See if this does what you want. I also changed w32HPaint to w32HEvent so the colapse and reshow of the combos would not happen when resizing the main window. -- code generated by Win32Lib IDE v0.14.2 include Win32lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) constant Combo2 = createEx( Combo, "Combo2", Window1, 44, 64, 148, 420*6, 0, 0 ) constant Combo4 = createEx( Combo, "Combo4", Window1, 208, 64, 148, 20*6, 0, 0 ) --------------------------------------------------------- ---------------------------------------------------------------------------- ---- object dummy ---------------------------------------------------------------------------- ---- procedure Window1_onEvent (integer self, integer event, sequence --procedure Window1_onPaint (integer self, integer event, sequence params)--params is ( int x1, int y1, int x2, int y2 ) int result,index,index2 if params[1]=WM_MOVE then --find active index index=getIndex(Combo2) index2=getIndex(Combo4) result = sendMessage ( Combo2, CB_GETDROPPEDSTATE , 0, 0 ) if result = 1 then dummy = sendMessage(Combo2, CB_SHOWDROPDOWN, False,0) dummy = sendMessage(Combo2, CB_SHOWDROPDOWN, True,0) end if index2=getIndex(Combo4) result = sendMessage ( Combo4, CB_GETDROPPEDSTATE , 0, 0 ) if result = 1 then dummy = sendMessage(Combo4, CB_SHOWDROPDOWN, False,0) dummy = sendMessage(Combo4, CB_SHOWDROPDOWN, True,0) end if setIndex(Combo2,index) setIndex(Combo4,index2) end if end procedure --setHandler( Window1, w32HPaint, routine_id("Window1_onPaint")) setHandler( Window1, w32HEvent, routine_id("Window1_onEvent")) ---------------------------------------------------------------------------- ---- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () for n = 1 to 15 do addItem( Combo2, "Item" & sprint(n) ) end for dummy = sendMessage(Combo2, CB_SHOWDROPDOWN, False,0) dummy = sendMessage(Combo2, CB_SHOWDROPDOWN, True,0) setIndex( Combo2, 1 ) for n = 1 to 15 do addItem( Combo4, "Item" & sprint(n) ) end for setIndex( Combo4, 1 ) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) WinMain( Window1,Normal ) >>But now I see another problem: >>if a drop-down list has been scrolled downward, & the window it's in is >>moved, it would be nice to have the list be shown after the move just as it >>was before; so I tried to use "CB_GETTOPINDEX", which is supposed to get the >>index of the topmost *showing* item on the list. But when I do so, I always >get a return of "0", instead of the zero based index of the topmost showing >>item. Anyone have any idea what I'm doing wrong? >>Dan Moyer