FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour combobox
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
combobox
Posted: Fri Mar 06, 2009 12:21 AM
I must insert a combo on buttonbar with bitmaps
When I insert it the combo is too small and I cannot see the images
any idea ?

Code (fw): Select all Collapse
#Include "FiveWin.Ch"

Function Test 
 Local oDlg,oBar 
  Local oItems
  Local aBitmaps := { "OMBRELLONE","PASSERELLA","HAWAYANO","CABINA", "CANCELLA" }
  Local aItems   := { "Normale","Passerella","Hawayano","Cabina", "Cancella" }
 nItem   := 1
 DEFINE DIALOG oDlg 
 
ACTIVATE DIALOG oDlg ON INIT CREA_BAR(oDlg ,aBitmaps,oItems,aItems,nItem )
RETURN NIL


FUNCTION CREA_BAR(oDlg ,aBitmaps,oItems,aItems,nItem )
lOCAL oBar
DEFINE BUTTONBAR oBar OF oDlg SIZE 60, 60 2007
@ 2, 2 COMBOBOX oItems VAR nItem ITEMS aItems BITMAPS aBitmaps of oBar SIZE 100, 100
RETURN NIL
Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Fri Mar 06, 2009 02:54 AM

Note that the SIZE clause is for the size of the dropdown not the GET-like portion of the combobox. Try setting the height using: oItems:nHeight = ...

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: combobox
Posted: Fri Mar 06, 2009 09:04 AM

I made also oItems:nheight:=200 NOT RUN

Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Fri Mar 06, 2009 03:10 PM

Falconi,

aBitmaps in your example code is not an array of bitmaps, it is an array of strings. You need to load aBitmaps with bitmaps.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: combobox
Posted: Sat Mar 07, 2009 01:26 AM
James ,
What you sad ?
Best Regards, Saludos



Falconi Silvio
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: combobox
Posted: Sat Mar 07, 2009 06:07 AM
Hi Silvio:

I've been testing with your problem. It seems to be a FWH bug because same combobox code is shown diferent in a Window and in a Dialog.


By manuelmercado

Here is the dialog code:
Code (fw): Select all Collapse
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   Local oDlg, oCbx, ;
         nItem := 1

   SET _3DLOOK ON

   DEFINE DIALOG oDlg FROM 0, 0 TO 220, 220 PIXEL
   
   @  20,  20 COMBOBOX oCbx VAR nItem OF oDlg SIZE 50, 200 PIXEL ;
      ITEMS   {"Vacio", "Hawayano", "Ombrellone", "Paserella" } ;
      BITMAPS { "VACIO", "HAWAYANO", "OMBRELLONE", "PASSERELLA" }

   ACTIVATE DIALOG oDlg

Return Nil


And here the code for a window:
Code (fw): Select all Collapse
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   Local oWnd, oCbx, ;
         nItem := 1

   SET _3DLOOK ON

   DEFINE WINDOW oWnd FROM 0, 0 TO 220, 220 PIXEL
   
   @  40,  40 COMBOBOX oCbx VAR nItem OF oWnd SIZE 100, 400 PIXEL ;
      ITEMS   {"Vacio", "Hawayano", "Ombrellone", "Paserella" } ;
      BITMAPS { "VACIO", "HAWAYANO", "OMBRELLONE", "PASSERELLA" }

   ACTIVATE WINDOW oWnd

Return Nil

Perhaps Antonio could help us.

Regards.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: combobox
Posted: Sat Mar 07, 2009 06:14 AM
Silvio wrote:I must insert a combo on buttonbar with bitmaps
When I insert it the combo is too small and I cannot see the images
any idea ?


the real problem of silvio is...
he want the combobox OVER BUTTONBAR no over dialog or over window
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: combobox
Posted: Sat Mar 07, 2009 03:33 PM

right !
i need a combo on buttonbar

Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Sat Mar 07, 2009 03:49 PM
Manuel seems to have found a key to the problem. And, Daniel, note that the buttonbar class is a subclass of TControl, which is a subclass of TWindow. This seems to be why what Manuel has shown is still the problem--windows and dialogs use different "units" of dimensions.

Dialog units are about twice as large as Window units, thus the combobox on a Window has a row height about half that of a combobox on a dialog. So, if we can find where the row height is defined, then perhaps we can solve the problem.

After looking at the combobox source, I don't see a nRowHeight var, but I did find this:

Code (fw): Select all Collapse
METHOD FillMeasure( nPInfo ) INLINE  LbxMeasure( nPInfo, ::nBmpHeight )

Silvio, for a quick test try changing this line to:

Code (fw): Select all Collapse
METHOD FillMeasure( nPInfo ) INLINE  LbxMeasure( nPInfo, ::nBmpHeight * 2.05 )

Then compile the combobox.prg and link it to your app and see if it solves the problem. If this works then we need modify the method to only change the row height when the parent container is not a dialog.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: combobox
Posted: Sat Mar 07, 2009 06:39 PM
James Bott wrote:After looking at the combobox source, I don't see a nRowHeight var, but I did find this:

Code (fw): Select all Collapse
METHOD FillMeasure( nPInfo ) INLINE  LbxMeasure( nPInfo, ::nBmpHeight )

Hi James:

The FillMeasure method is only called when the ComboBox belongs to a Dialog, not in other cases. It might be the problem.

Best regards.

Manuel Mercado.
manuelmercado at prodigy dot net dot mx
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: combobox
Posted: Sat Mar 07, 2009 07:20 PM
I found something:

If I change the New() method of class TComboBox in these lines:
Code (fw): Select all Collapse
   if ! Empty( oWnd:hWnd )
      ::Create( "COMBOBOX" )
      ::Default()
      if oFont != nil
         ::SetFont( oFont )
      endif
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

To this:
Code (fw): Select all Collapse
   if ! Empty( oWnd:hWnd )
      oWnd:AddControl( Self )
      ::Create( "COMBOBOX" )
      ::Default()
      if oFont != nil
         ::SetFont( oFont )
      endif
   else
      oWnd:DefControl( Self )
   endif

Then the combobox is shown fine.

Antonio will tell us if the change has or not secondary effects.

Regards.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: combobox
Posted: Sun Mar 08, 2009 12:57 AM

Manuel ,
Now I see the bitmaps good but I cannot select any element
when I open the test it open the scroll of elements I select one element and then the control is blocked
there is also an error

Best Regards, Saludos



Falconi Silvio
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: combobox
Posted: Mon Mar 09, 2009 10:41 PM
Hi Silvio,

don't forget the Bitmap for the towels the German use to reserve their places at the beach. :-)



Sorry, i couldn't resist.
Regards,
Detlef
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: combobox
Posted: Tue Mar 10, 2009 01:04 AM

Any solution ?

Best Regards, Saludos



Falconi Silvio

Continue the discussion