Combobox with bitmaps

Combobox with bitmaps

Postby TimStone » Tue Feb 08, 2011 12:32 am

I've searched all over for this, and of course I've experimented without success.

I want to have a combobox where the dropdown includes a bitmap for each line.

The docs say to create an array of items, and an array of bitmaps ( which do reside in the RESOURCES file ). I've done that. It then seems to say the bitmap will display next to the corresponding item array ( ie. bitmap 4 in the array of bitmaps should load to item 4 of the drop down list ).

I've looked everywhere for a sample but can't find it ( docs, online docs, forum, etc. ).

Can anyone provide a sample ? Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2930
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Combobox with bitmaps

Postby ukoenig » Tue Feb 08, 2011 1:23 am

Hello Tim,

Image

Samples : Ownerdra.prg
( Bitmaps from Disk and resource )

REDEFINE COMBOBOX oCbx1 VAR cItem2 ;
ID 120 OF oDlg ;
ITEMS { "Drive A:", "Drive C:", "Ram Drive", "Net Drive" } ;
BITMAPS { "..\bitmaps\fdrive.bmp",;
"..\bitmaps\hdrive.bmp",; // from Disk
"Arrow",; // from Resource
"..\bitmaps\netdrive.bmp" }

Best Regards
uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Combobox with bitmaps

Postby TimStone » Tue Feb 08, 2011 2:55 am

How do you have the control in the .rc file ?

I am using:
REDEFINE COMBOBOX oCB2 VAR cAptClr ;
ID 4065 OF oCalDlg ;
ITEMS { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } ;
BITMAPS { "CJ01","CJ02", "CJ03", "CJ04", "CJ05", "CJ06", "CJ07", ;
"CJ08","CJ09", "CJ10" } ;
MESSAGE "Enter the technician, or service area, for this appointment"

And:
CONTROL "", 4065, "ComboBox", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_TABSTOP, 300, 30, 80, 100

My bitmaps are 10 x 10 Solid color squares.

They won't show up ...

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2930
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Combobox with bitmaps

Postby nageswaragunupudi » Tue Feb 08, 2011 7:58 am

This is the rc file used in the above sample
\fwh\samples\ownerdra.rc
Code: Select all  Expand view
#include "..\include\WinApi.ch"

test DIALOG 16, 80, 274, 132
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | 4
CAPTION "ListBoxes and ComboBoxes with Bitmaps!"
FONT 8, "MS Sans Serif"
BEGIN
    LTEXT "An OwnerDraw ListBox!", -1, 4, 5, 78, 9, WS_CHILD | WS_VISIBLE | WS_GROUP
    LISTBOX 110, 5, 17, 75, 87, LBS_NOTIFY | LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP
    LTEXT "An OwnerDraw ComboBox!", -1, 88, 4, 88, 9, WS_CHILD | WS_VISIBLE | WS_GROUP
    CONTROL "", 120, "COMBOBOX", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_TABSTOP, 95, 16, 75, 82
    LTEXT "Run-time selection!", -1, 184, 3, 64, 9, WS_CHILD | WS_VISIBLE | WS_GROUP
    CONTROL "", 130, "LISTBOX", LBS_NOTIFY | LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 183, 15, 75, 91
    CONTROL "Your imagination is the limit", -1, "STATIC", WS_CHILD | WS_VISIBLE | WS_GROUP, 88, 44, 91, 8
    CONTROL "", 140, "COMBOBOX", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 96, 57, 75, 101
    PUSHBUTTON "&Ok", IDOK, 119, 110, 35, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10489
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Combobox with bitmaps

Postby TimStone » Tue Feb 08, 2011 3:06 pm

I think the issue is with my bitmaps. I will work with them today. Initially I had 10x10 and they didn't display. Then I tried 16x16 but I wanted them larger so I went to 16 x 32 ( wide ) and they didn't work. I did get a 16x16 to display. The space is being provided for them.

Thanks
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2930
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Combobox with bitmaps

Postby ukoenig » Tue Feb 08, 2011 3:39 pm

Tim,

my Tests using 16x16, 24x24 and 24x32
It seems, only 16 x 16 is possible.
I changed the Font, to force the Rowheight to be bigger,
but the Bmp is resized as well.
Maybe it is possible, to delete BMP-resizing ( keeping the original BMP-Size ? )
I think to adjust the Row-height to the BMP ( in case BMP-height >= Font-height, like in xBrowse )
it would be a better Solution.
I will have a look at the Class Combobox.

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Combobox with bitmaps

Postby TimStone » Tue Feb 08, 2011 5:49 pm

I had tried 8 bit and even they didn't work. It would appear 16x16 Alpha does work, so I'm resetting them to that and hopefully this will be done. I use Axialis for my icons and bitmaps so it really is very easy to make changes.

Thanks.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2930
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Combobox with bitmaps

Postby ukoenig » Tue Feb 08, 2011 8:27 pm

Tim,

I tested many graphic-tools and ended on this one :

viewtopic.php?f=3&t=15008&p=77576&hilit=pixelformer#p77576

Best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests