2012-01-23 17:49 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/gtwvg/wvg3stat.prg
  * contrib/gtwvg/wvgcheck.prg
  * contrib/gtwvg/wvgdatar.prg
  * contrib/gtwvg/wvglistb.prg
  * contrib/gtwvg/wvgmle.prg
  * contrib/gtwvg/wvgparts.ch
  * contrib/gtwvg/wvgradio.prg
  * contrib/gtwvg/wvgscrlb.prg
  * contrib/gtwvg/wvgsle.prg
  * contrib/gtwvg/wvgstatc.prg
  * contrib/gtwvg/wvgtreev.prg
    * Changed: Class DataRef() => WvgDataRef()
       It was conflicting with DataRef() in hbXBP implementation
       rendering both libraries mutually exclusive.

  * contrib/gtwvg/wvgcombo.prg
    + Implemented: WvgComboBox() exactly per Xbase++ documentation.

  * contrib/gtwvg/wvgwin.c
    + Added: WVG_SendCBMessage( hWnd, nMessage, wParam, lParam ) => xRetValue.

  * contrib/gtwvg/wvtwin.ch
    + Added: few missing CB_* constants.

  * contrib/gtwvg/tests/wvgtbrowser.prg
    + Demonstrated: WvgComboBox() functionality by replacing 
       index orders list box with combobox.
This commit is contained in:
Pritpal Bedi
2012-01-24 01:57:08 +00:00
parent 70954e9b18
commit e042ed419a
16 changed files with 522 additions and 44 deletions

View File

@@ -16,6 +16,35 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-01-23 17:49 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/wvg3stat.prg
* contrib/gtwvg/wvgcheck.prg
* contrib/gtwvg/wvgdatar.prg
* contrib/gtwvg/wvglistb.prg
* contrib/gtwvg/wvgmle.prg
* contrib/gtwvg/wvgparts.ch
* contrib/gtwvg/wvgradio.prg
* contrib/gtwvg/wvgscrlb.prg
* contrib/gtwvg/wvgsle.prg
* contrib/gtwvg/wvgstatc.prg
* contrib/gtwvg/wvgtreev.prg
* Changed: Class DataRef() => WvgDataRef()
It was conflicting with DataRef() in hbXBP implementation
rendering both libraries mutually exclusive.
* contrib/gtwvg/wvgcombo.prg
+ Implemented: WvgComboBox() exactly per Xbase++ documentation.
* contrib/gtwvg/wvgwin.c
+ Added: WVG_SendCBMessage( hWnd, nMessage, wParam, lParam ) => xRetValue.
* contrib/gtwvg/wvtwin.ch
+ Added: few missing CB_* constants.
* contrib/gtwvg/tests/wvgtbrowser.prg
+ Demonstrated: WvgComboBox() functionality by replacing
index orders list box with combobox.
2012-01-20 16:35 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/wvgdatar.prg
* Fixed: :setData() method for WvgListBox().

View File

@@ -377,7 +377,6 @@ STATIC FUNCTION BrwSetThisOrder( oBrw, nOrd )
STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw )
LOCAL oXbp, i, cKey, aIdx := {}
FOR i := 1 TO 10
IF ( cKey := IndexKey( i ) ) == ""
EXIT
@@ -385,11 +384,12 @@ STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw )
aadd( aIdx, OrdName( i ) + ": " + cKey )
NEXT
oXbp := WvgListBox():new( oCrt )
oXbp := WvgComboBox():new( oCrt )
oXbp:type := WVGCOMBO_DROPDOWN
oXbp:create( , , { -18,-1 }, { -5, -10 }, , .t. )
oXbp:setColorFG( "W+" )
oXbp:setColorBG( "B*" )
oXbp:itemMarked := {|m1,m2,o| m1 := m2, BrwSetThisOrder( oBrw, max( 0, ascan( aIdx, o:getCurItem() )-1 ) ) }
oXbp:itemMarked := {|m1,m2,o| m1 := m2, BrwSetThisOrder( oBrw, o:XbpListBox:getData()-1 ) }
oXbp:addItem( "Natural Order" )
FOR i := 1 TO len( aIdx )
oXbp:addItem( aIdx[ i ] )

View File

@@ -82,7 +82,7 @@
/*----------------------------------------------------------------------*/
CLASS Wvg3State INHERIT WvgWindow, DataRef
CLASS Wvg3State INHERIT WvgWindow, WvgDataRef
DATA autosize INIT .F.
DATA caption INIT ""

View File

@@ -76,7 +76,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgCheckBox INHERIT WvgWindow, DataRef
CLASS WvgCheckBox INHERIT WvgWindow, WvgDataRef
DATA autosize INIT .F.
DATA caption INIT ""

View File

@@ -76,63 +76,278 @@
/*----------------------------------------------------------------------*/
CLASS WvgComboBox INHERIT WvgListBox /* WvgSLE */
CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef
DATA type INIT WVGCOMBO_DROPDOWN
DATA drawMode INIT WVG_DRAW_NORMAL
DATA nCurSelected INIT 0
DATA aInfo INIT NIL
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD destroy()
METHOD handleEvent( nMessage, aNM )
METHOD sendCBMessage( nMsg, wParam, lParam ) INLINE WVG_SendCBMessage( ::pWnd, nMsg, wParam, lParam )
METHOD listBoxFocus( lFocus )
METHOD listBoxSize()
METHOD sleSize()
METHOD addItem( cItem )
METHOD clear() INLINE ::sendCBMessage( CB_RESETCONTENT )
METHOD delItem( nIndex ) INLINE ::sendCBMessage( CB_DELETESTRING, nIndex-1 )
METHOD getItem( nIndex ) INLINE ::sendCBMessage( CB_GETLBTEXT, nIndex-1 )
METHOD insItem( nIndex, cItem ) INLINE ::sendCBMessage( CB_INSERTSTRING, nIndex-1, cItem )
METHOD setItem( nIndex, cItem ) VIRTUAL
METHOD setIcon( nItem, cIcon )
DATA oSLE
DATA oListBox
ACCESS XbpSLE INLINE ::oSLE
ACCESS XbpListBox INLINE ::oListBox
DATA sl_itemMarked
DATA sl_itemSelected
DATA sl_drawItem
METHOD itemMarked( ... ) SETGET
METHOD itemSelected( ... ) SETGET
METHOD drawItem( ... ) SETGET
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox
METHOD WvgComboBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + WS_TABSTOP + WS_BORDER + WS_VSCROLL + CBS_NOINTEGRALHEIGHT + CBS_AUTOHSCROLL
//::exStyle := WS_EX_CLIENTEDGE
::style := WS_CHILD
::className := "BUTTON"
::objType := objTypePushButton
::className := "COMBOBOX"
::objType := objTypeComboBox
RETURN Self
/*----------------------------------------------------------------------*/
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox
METHOD WvgComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oParent:AddChild( Self )
IF ::type == WVGCOMBO_DROPDOWNLIST
::style += CBS_DROPDOWNLIST
ELSEIF ::type == WVGCOMBO_SIMPLE
::style += CBS_SIMPLE
ELSE
::style += CBS_DROPDOWN
ENDIF
::createControl()
::SetWindowProcCallback()
#if 0
::SetWindowProcCallback() /* Let parent control the events - WM_COMMAND */
#endif
IF ::visible
::show()
ENDIF
::setPosAndSize()
/* Build SLE and ListBox Part - May not be available for all Windows Versions - How to handle then ? */
IF ! empty( ::aInfo := ::sendCBMessage( CB_GETCOMBOBOXINFO ) )
::oSLE := WvgSLE():new()
::oSLE:oParent := Self
::oSLE:hWnd := ::aInfo[ 5 ]
::oSLE:pWnd := Win_N2P( ::aInfo[ 5 ] )
::oListBox := WvgListBox():new()
::oListBox:oParent := Self
::oListBox:hWnd := ::aInfo[ 6 ]
::oListBox:pWnd := Win_N2P( ::aInfo[ 6 ] )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox
METHOD WvgComboBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD destroy() CLASS WvgComboBox
METHOD WvgComboBox:destroy()
#if 0
IF hb_isObject( ::oSLE )
::oSLE:destroy()
ENDIF
IF hb_isObject( ::oListBox )
::oListBox:destroy()
ENDIF
#endif
::wvgWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:handleEvent( nMessage, aNM )
DO CASE
CASE nMessage == HB_GTE_RESIZED
IF ::isParentCrt()
::rePosition()
ENDIF
::sendMessage( WM_SIZE, 0, 0 )
CASE nMessage == HB_GTE_COMMAND
IF aNM[ 1 ] == CBN_SELCHANGE
::nCurSelected := ::editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
::itemMarked()
IF ::isParentCrt()
IF ::pointerFocus
::setFocus()
ENDIF
ENDIF
ELSEIF aNM[ 1 ] == CBN_DBLCLK
::editBuffer := ::nCurSelected
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
::itemSelected()
IF ::isParentCrt()
IF ::pointerFocus
::setFocus()
ENDIF
ENDIF
ELSEIF aNM[ 1 ] == CBN_KILLFOCUS
::killInputFocus()
ELSEIF aNM[ 1 ] == CBN_SETFOCUS
::setInputFocus()
ENDIF
CASE nMessage == HB_GTE_KEYTOITEM
IF aNM[ 1 ] == K_ENTER
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
::itemSelected()
IF ::isParentCrt()
IF ::pointerFocus
::setFocus()
ENDIF
ENDIF
ENDIF
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
WVG_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
WVG_SetBkMode( aNM[ 1 ], 1 )
RETURN ::hBrushBG
ELSE
RETURN WVG_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:addItem( cItem )
IF hb_isChar( cItem )
RETURN ::sendCBMessage( CB_ADDSTRING, cItem )
ENDIF
RETURN -1
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:listBoxFocus( lFocus )
LOCAL lOldFocus := ::sendCBMessage( CB_GETDROPPEDSTATE )
IF hb_isLogical( lFocus )
::sendCBMessage( CB_SHOWDROPDOWN, lFocus )
ENDIF
RETURN lOldFocus
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:sleSize()
IF hb_isObject( ::oSLE )
RETURN ::oSLE:currentSize()
ENDIF
RETURN {0,0}
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:listBoxSize()
IF hb_isObject( ::oListBox )
RETURN ::oListBox:currentSize()
ENDIF
RETURN {0,0}
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:setIcon( nItem, cIcon )
HB_SYMBOL_UNUSED( nItem )
HB_SYMBOL_UNUSED( cIcon )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:itemMarked( ... )
LOCAL a_:= hb_aParams()
IF len( a_ ) == 1 .AND. hb_isBlock( a_[ 1 ] )
::sl_itemMarked := a_[ 1 ]
ELSEIF len( a_ ) >= 0 .AND. hb_isBlock( ::sl_itemMarked )
eval( ::sl_itemMarked, NIL, NIL, Self )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:itemSelected( ... )
LOCAL a_:= hb_aParams()
IF len( a_ ) == 1 .AND. hb_isBlock( a_[ 1 ] )
::sl_itemSelected := a_[ 1 ]
ELSEIF len( a_ ) >= 0 .AND. hb_isBlock( ::sl_itemSelected )
eval( ::sl_itemSelected, NIL, NIL, Self )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgComboBox:drawItem( ... )
LOCAL a_:= hb_aParams()
IF len( a_ ) == 1 .AND. hb_isBlock( a_[ 1 ] )
::sl_xbePDrawItem := a_[ 1 ]
ELSEIF len( a_ ) >= 2 .AND. hb_isBlock( ::sl_xbePDrawItem )
eval( ::sl_xbePDrawItem, a_[ 1 ], a_[ 2 ], Self )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
/* MSDN on ComboBox Control */
/*----------------------------------------------------------------------*/

View File

@@ -76,13 +76,7 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS DataRef
CLASS WvgDataRef
DATA changed INIT .F.
DATA dataLink INIT NIL
@@ -109,19 +103,40 @@ CLASS DataRef
/*----------------------------------------------------------------------*/
METHOD DataRef:new()
METHOD WvgDataRef:new()
RETURN self
/*----------------------------------------------------------------------*/
METHOD DataRef:getData()
METHOD WvgDataRef:getData()
DO CASE
CASE ::className == "COMBOBOX"
IF hb_isObject( ::XbpListBox ) .AND. hb_isBlock( ::XbpListBox:dataLink )
::sl_editBuffer := ::XbpListBox:getData()
ELSEIF hb_isObject( ::XbpSLE ) .AND. hb_isBlock( ::XbpSLE:dataLink )
::sl_editBuffer := ::XbpSLE:getData()
ELSEIF hb_isObject( ::XbpListBox )
::sl_editBuffer := ::XbpListBox:getData()
ENDIF
CASE ::className == "EDIT"
::sl_editBuffer := WVG_GetMessageText( ::hWnd, WM_GETTEXT, ::bufferLength + 1 )
CASE ::className == "LISTBOX"
::sl_editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1
#if 0 /* This is contrary the documentation of Xbase++ */
IF ::oParent:className == "COMBOBOX"
::sl_editBuffer := {}
FOR i := 1 TO ::numItems()
aadd( ::sl_editBuffer, ::getItem( i ) )
NEXT
ELSE
::sl_editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1
ENDIF
#endif
ENDCASE
IF hb_isBlock( ::dataLink )
@@ -132,16 +147,15 @@ METHOD DataRef:getData()
/*----------------------------------------------------------------------*/
METHOD DataRef:setData( xValue, mp2 )
METHOD WvgDataRef:setData( xValue, mp2 )
LOCAL s
HB_SYMBOL_UNUSED( mp2 )
IF hb_isBlock( ::dataLink )
::sl_editBuffer := eval( ::dataLink )
ELSEIF xValue <> NIL
::sl_editBuffer := xValue
ENDIF
DO CASE
@@ -153,7 +167,6 @@ METHOD DataRef:setData( xValue, mp2 )
IF hb_isNumeric( ::sl_editBuffer )
RETURN WVG_LBSetCurSel( ::hWnd, ::sl_editBuffer - 1 ) >= 0
ENDIF
RETURN .f.
CASE ::className == "SysTreeView32"
IF ::sl_editBuffer <> NIL .and. ::sl_editBuffer:hItem <> NIL
@@ -170,19 +183,28 @@ METHOD DataRef:setData( xValue, mp2 )
WAPI_SetScrollPos( ::pWnd, SB_CTL, ::sl_editBuffer, .t. )
ENDIF
CASE ::className == "COMBOBOX"
IF hb_isArray( ::sl_editBuffer )
// NOT sure which way it should behave.
// XBase++ documentation IN this regard is crappy.
FOR EACH s IN ::sl_editBuffer
::addItem( s )
NEXT
ENDIF
ENDCASE
RETURN ::sl_editBuffer
/*----------------------------------------------------------------------*/
METHOD DataRef:undo()
METHOD WvgDataRef:undo()
RETURN .f.
/*----------------------------------------------------------------------*/
METHOD DataRef:validate( xParam )
METHOD WvgDataRef:validate( xParam )
IF PCount() == 0 .and. hb_isBlock( ::sl_validate )
RETURN eval( ::sl_validate, self )

View File

@@ -76,7 +76,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgListBox INHERIT WvgWindow, DataRef
CLASS WvgListBox INHERIT WvgWindow, WvgDataRef
DATA adjustHeight INIT .F.
DATA horizScroll INIT .F.

View File

@@ -82,7 +82,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgMLE INHERIT WvgWindow, DataRef
CLASS WvgMLE INHERIT WvgWindow, WvgDataRef
DATA border INIT .T.
DATA editable INIT .T.

View File

@@ -216,6 +216,10 @@
#define WVGTOOLBAR_BUTTON_SEPARATOR 4
#define WVGCOMBO_SIMPLE 1
#define WVGCOMBO_DROPDOWN 2
#define WVGCOMBO_DROPDOWNLIST 3
#endif /* #ifndef _WVG_CH */
/*----------------------------------------------------------------------*/

View File

@@ -82,7 +82,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgRadioButton INHERIT WvgWindow, DataRef
CLASS WvgRadioButton INHERIT WvgWindow, WvgDataRef
DATA autosize INIT .F.
DATA caption INIT ""

View File

@@ -116,7 +116,7 @@ typedef struct tagRECT { ;
#endif
/*----------------------------------------------------------------------*/
CLASS WvgScrollBar INHERIT WvgWindow, DataRef
CLASS WvgScrollBar INHERIT WvgWindow, WvgDataRef
DATA autoTrack INIT .t.
DATA range INIT {0,1}

View File

@@ -76,7 +76,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgSLE INHERIT WvgWindow, DataRef
CLASS WvgSLE INHERIT WvgWindow, WvgDataRef
DATA align INIT WVGSLE_LEFT
DATA autoKeyboard INIT .T.

View File

@@ -106,7 +106,6 @@ METHOD WvgStatic:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
/* SS_NOTIFY SS_ETCHEDFRAME SS_SUNKEN SS_WHITERECT */
::style := WS_CHILD + WS_CLIPCHILDREN
::exStyle := WS_EX_NOPARENTNOTIFY
::className := "STATIC"
::objType := objTypeStatic
@@ -265,12 +264,11 @@ METHOD WvgStatic:handleEvent( nMessage, aNM )
RETURN WVG_GetCurrentBrush( aNM[ 1 ] )
ENDIF
#if 0 /* It should never reach here */
CASE nMessage == HB_GTE_ANY
IF ::isParentCrt()
ENDIF
#endif
ENDCASE

View File

@@ -76,7 +76,7 @@
/*----------------------------------------------------------------------*/
CLASS WvgTreeView INHERIT WvgWindow, DataRef
CLASS WvgTreeView INHERIT WvgWindow, WvgDataRef
DATA alwaysShowSelection INIT .F.
DATA hasButtons INIT .F.

View File

@@ -83,6 +83,10 @@
# define GCLP_HBRBACKGROUND -10
#endif
#if ! defined( CB_GETCOMBOBOXINFO )
# define CB_GETCOMBOBOXINFO 0x0164
#endif
#define WIN_STATUSBAR_MAX_PARTS 256
/*----------------------------------------------------------------------*/
@@ -1400,3 +1404,205 @@ HB_FUNC( WVG_SENDEDITCONTROLMESSAGE )
}
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_SENDCBMESSAGE )
{
HWND hCB = hbwapi_par_raw_HWND( 1 );
int msg = hbwapi_par_INT( 2 );
void * hText = NULL;
switch( msg )
{
case CB_ADDSTRING : // Adds a string to the list box of a combo box. If the combo box does not have the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted.
hb_retni( SendMessage( hCB, CB_ADDSTRING, ( WPARAM ) NULL, ( LPARAM ) ( LPCTSTR ) HB_PARSTR( 3, &hText, NULL ) ) );
break;
case CB_DELETESTRING : // Deletes a string in the list box of a combo box.
hb_retni( SendMessage( hCB, CB_DELETESTRING, hb_parni( 3 ), 0 ) );
break;
case CB_DIR : // Adds names to the list displayed by the combo box. The message adds the names of directories and files that match a specified string and set of file attributes. CB_DIR can also add mapped drive letters to the list.
hb_retni( SendMessage( hCB, CB_DIR, ( WPARAM ) hb_parni( 3 ), ( LPARAM ) HB_PARSTR( 4, &hText, NULL ) ) );
break;
case CB_FINDSTRING : // Searches the list box of a combo box for an item beginning with the characters in a specified string.
hb_retni( SendMessage( hCB, CB_FINDSTRING, ( WPARAM ) hb_parni( 3 ), ( LPARAM ) HB_PARSTR( 4, &hText, NULL ) ) );
break;
case CB_FINDSTRINGEXACT : // Finds the first list box string in a combo box that matches the string specified in the lParam parameter.
hb_retni( SendMessage( hCB, CB_FINDSTRINGEXACT, ( WPARAM ) hb_parni( 3 ), ( LPARAM ) HB_PARSTR( 4, &hText, NULL ) ) );
break;
case CB_GETCOMBOBOXINFO : // Gets information about the specified combo box.
{
COMBOBOXINFO cbi;
PHB_ITEM pCbi = hb_itemNew( NULL );
PHB_ITEM pRc1 = hb_itemNew( NULL );
PHB_ITEM pRc2 = hb_itemNew( NULL );
memset( &cbi, 0, sizeof( COMBOBOXINFO ) );
cbi.cbSize = sizeof( COMBOBOXINFO );
if( GetComboBoxInfo( hCB, &cbi ) )
{
hb_arrayNew( pCbi, 6 );
hb_arrayNew( pRc1, 4 );
hb_arrayNew( pRc2, 4 );
hb_arraySetNI( pRc1, 1, cbi.rcItem.left );
hb_arraySetNI( pRc1, 2, cbi.rcItem.top );
hb_arraySetNI( pRc1, 3, cbi.rcItem.right );
hb_arraySetNI( pRc1, 4, cbi.rcItem.bottom );
hb_arraySet( pCbi, 1, pRc1 );
hb_arraySetNI( pRc2, 1, cbi.rcButton.left );
hb_arraySetNI( pRc2, 2, cbi.rcButton.top );
hb_arraySetNI( pRc2, 3, cbi.rcButton.right );
hb_arraySetNI( pRc2, 4, cbi.rcButton.bottom );
hb_arraySet( pCbi, 2, pRc2 );
hb_arraySetNInt( pCbi, 3, cbi.stateButton );
hb_arraySetNInt( pCbi, 4, ( HB_PTRDIFF ) cbi.hwndCombo );
hb_arraySetNInt( pCbi, 5, ( HB_PTRDIFF ) cbi.hwndItem );
hb_arraySetNInt( pCbi, 6, ( HB_PTRDIFF ) cbi.hwndList );
hb_itemReturnRelease( pCbi );
hb_itemRelease( pRc1 );
hb_itemRelease( pRc2 );
}
break;
}
case CB_GETCOUNT : // Gets the number of items in the list box of a combo box.
hb_retni( SendMessage( hCB, CB_GETCOUNT, 0, 0 ) );
break;
#if ( _WIN32_IE >= 0x0600 )
case CB_GETCUEBANNER : // Gets the cue banner text displayed in the edit control of a combo box. Send this message explicitly or by using the ComboBox_GetCueBannerText macro.
break;
#endif
case CB_GETCURSEL : // An application sends a CB_GETCURSEL message to retrieve the index of the currently selected item, if any, in the list box of a combo box.
hb_retni( SendMessage( hCB, CB_GETCURSEL, 0, 0 ) );
break;
case CB_GETDROPPEDCONTROLRECT : // An application sends a CB_GETDROPPEDCONTROLRECT message to retrieve the screen coordinates of a combo box in its dropped-down state.
{
RECT rc;
PHB_ITEM pRect = hb_itemNew( NULL );
SendMessage( hCB, CB_GETDROPPEDCONTROLRECT, 0, ( LPARAM ) &rc );
hb_arrayNew( pRect, 4 );
hb_arraySetNI( pRect, 1, rc.left );
hb_arraySetNI( pRect, 2, rc.top );
hb_arraySetNI( pRect, 3, rc.right );
hb_arraySetNI( pRect, 4, rc.bottom );
hb_itemReturnRelease( pRect );
break;
}
case CB_GETDROPPEDSTATE : // Determines whether the list box of a combo box is dropped down.
hb_retl( SendMessage( hCB, CB_GETDROPPEDSTATE, 0, 0 ) );
break;
case CB_GETDROPPEDWIDTH : // Gets the minimum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
hb_retni( SendMessage( hCB, CB_GETDROPPEDWIDTH, 0, 0 ) );
break;
case CB_GETEDITSEL : // Gets the starting and ending character positions of the current selection in the edit control of a combo box.
{
DWORD range = SendMessage( hCB, CB_GETEDITSEL, ( WPARAM ) NULL, ( LPARAM ) NULL );
PHB_ITEM pRng = hb_itemNew( NULL );
hb_arrayNew( pRng, 2 );
hb_arraySetNI( pRng, 1, LOWORD( range ) );
hb_arraySetNI( pRng, 1, HIWORD( range ) );
hb_itemReturnRelease( pRng );
break;
}
case CB_GETEXTENDEDUI : // Determines whether a combo box has the default user interface or the extended user interface.
hb_retl( SendMessage( hCB, CB_GETEXTENDEDUI, 0, 0 ) );
break;
case CB_GETHORIZONTALEXTENT : // Gets the width, in pixels, that the list box can be scrolled horizontally (the scrollable width). This is applicable only if the list box has a horizontal scroll bar.
hb_retni( SendMessage( hCB, CB_GETHORIZONTALEXTENT, 0, 0 ) );
break;
case CB_GETITEMDATA : // An application sends a CB_GETITEMDATA message to a combo box to retrieve the application-supplied value associated with the specified item in the combo box.
hb_retnint( SendMessage( hCB, CB_GETITEMDATA, hb_parni( 3 ), 0 ) );
break;
case CB_GETITEMHEIGHT : // Determines the height of list items or the selection field in a combo box.
hb_retni( SendMessage( hCB, CB_GETITEMHEIGHT, 0, 0 ) );
break;
case CB_GETLBTEXT : // Gets a string from the list of a combo box.
{
int iSize = SendMessage( hCB, CB_GETLBTEXTLEN, hb_parni( 3 ), 0 );
TCHAR * text = hb_xgrab( iSize + 1 );
SendMessage( hCB, CB_GETLBTEXT, iSize, ( LPARAM ) text );
HB_RETSTR( text );
hb_xfree( text );
break;
}
case CB_GETLBTEXTLEN : // Gets the length, in characters, of a string in the list of a combo box.
hb_retni( SendMessage( hCB, CB_GETLBTEXTLEN, hb_parni( 3 ), 0 ) );
break;
case CB_GETLOCALE : // Gets the current locale of the combo box. The locale is used to determine the correct sorting order of displayed text for combo boxes with the CBS_SORT style and text added by using the CB_ADDSTRING message.
#if ( _WIN32_IE >= 0x0600 )
case CB_GETMINVISIBLE : // Gets the minimum number of visible items in the drop-down list of a combo box.
hb_retni( SendMessage( hCB, CB_GETMINVISIBLE, 0, 0 ) );
break;
#endif
case CB_GETTOPINDEX : // An application sends the CB_GETTOPINDEX message to retrieve the zero-based index of the first visible item in the list box portion of a combo box. Initially, the item with index 0 is at the top of the list box, but if the list box contents have been scrolled, another item may be at the top.
hb_retni( SendMessage( hCB, CB_GETTOPINDEX, 0, 0 ) );
break;
case CB_INITSTORAGE : // An application sends the CB_INITSTORAGE message before adding a large number of items to the list box portion of a combo box. This message allocates memory for storing list box items.
break;
case CB_INSERTSTRING : // Inserts a string or item data into the list of a combo box. Unlike the CB_ADDSTRING message, the CB_INSERTSTRING message does not cause a list with the CBS_SORT style to be sorted.
hb_retni( SendMessage( hCB, CB_INSERTSTRING, ( WPARAM ) hb_parni( 3 ), ( LPARAM ) HB_PARSTR( 4, &hText, NULL ) ) );
break;
case CB_LIMITTEXT : // Limits the length of the text the user may type into the edit control of a combo box.
SendMessage( hCB, CB_LIMITTEXT, hb_parni( 3 ), 0 );
break;
case CB_RESETCONTENT : // Removes all items from the list box and edit control of a combo box.
SendMessage( hCB, CB_RESETCONTENT, 0, 0 );
break;
case CB_SELECTSTRING : // Searches the list of a combo box for an item that begins with the characters in a specified string. If a matching item is found, it is selected and copied to the edit control.
hb_retni( SendMessage( hCB, CB_SELECTSTRING, ( WPARAM ) hb_parni( 3 ), ( LPARAM ) HB_PARSTR( 4, &hText, NULL ) ) );
break;
#if ( _WIN32_IE >= 0x0600 )
case CB_SETCUEBANNER : // Sets the cue banner text that is displayed for the edit control of a combo box.
break;
#endif
case CB_SETCURSEL : // An application sends a CB_SETCURSEL message to select a string in the list of a combo box. If necessary, the list scrolls the string into view. The text in the edit control of the combo box changes to reflect the new selection, and any previous selection in the list is removed.
hb_retni( SendMessage( hCB, CB_SETCURSEL, hb_parni( 3 ), 0 ) );
break;
case CB_SETDROPPEDWIDTH : // An application sends the CB_SETDROPPEDWIDTH message to set the maximum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
hb_retni( SendMessage( hCB, CB_SETDROPPEDWIDTH, hb_parni( 3 ), 0 ) );
break;
case CB_SETEDITSEL : // An application sends a CB_SETEDITSEL message to select characters in the edit control of a combo box.
break;
case CB_SETEXTENDEDUI : // An application sends a CB_SETEXTENDEDUI message to select either the default UI or the extended UI for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
SendMessage( hCB, CB_SETEXTENDEDUI, hb_parl( 3 ), 0 );
break;
case CB_SETHORIZONTALEXTENT : // An application sends the CB_SETHORIZONTALEXTENT message to set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width). If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.
SendMessage( hCB, CB_SETHORIZONTALEXTENT, hb_parl( 3 ), 0 );
break;
case CB_SETITEMDATA : // An application sends a CB_SETITEMDATA message to set the value associated with the specified item in a combo box.
SendMessage( hCB, CB_SETITEMDATA, hb_parl( 3 ), ( LPARAM ) hb_parnint( 4 ) );
break;
case CB_SETITEMHEIGHT : // An application sends a CB_SETITEMHEIGHT message to set the height of list items or the selection field in a combo box.
hb_retni( SendMessage( hCB, CB_SETITEMHEIGHT, hb_parni( 3 ), 0 ) );
break;
case CB_SETLOCALE : // An application sends a CB_SETLOCALE message to set the current locale of the combo box. If the combo box has the CBS_SORT style and strings are added using CB_ADDSTRING, the locale of a combo box affects how list items are sorted.
hb_retnint( SendMessage( hCB, CB_SETLOCALE, hb_parnint( 3 ), 0 ) );
break;
#if ( _WIN32_IE >= 0x0600 )
case CB_SETMINVISIBLE : // An application sends a CB_SETMINVISIBLE message to set the minimum number of visible items in the drop-down list of a combo box.
hb_retl( SendMessage( hCB, CB_SETMINVISIBLE, hb_parni( 3 ), 0 ) );
break;
#endif
case CB_SETTOPINDEX : // An application sends the CB_SETTOPINDEX message to ensure that a particular item is visible in the list box of a combo box. The system scrolls the list box contents so that either the specified item appears at the top of the list box or the maximum scroll range has been reached.
hb_retl( SendMessage( hCB, CB_SETTOPINDEX, hb_parni( 3 ), 0 ) ? FALSE : TRUE );
break;
break;
case CB_SHOWDROPDOWN : // An application sends a CB_SHOWDROPDOWN message to show or hide the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
SendMessage( hCB, CB_SHOWDROPDOWN, hb_parl( 3 ), 0 );
break;
}
if( hText )
hb_strfree( hText );
}
/*----------------------------------------------------------------------*/

View File

@@ -833,6 +833,10 @@
#define CB_GETDROPPEDWIDTH 351
#define CB_SETDROPPEDWIDTH 352
#define CB_INITSTORAGE 353
#define CB_MULTIPLEADDSTRING 0x0163
#define CB_GETCOMBOBOXINFO 0x0164
#define CB_MSGMAX 0x0165
/*----------------------------------------------------------------------*/
/*