FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Sat Sep 29, 2012 03:56 PM
To All

I have built a Combobox from Resource and using the styles CBS_DROPDOWN ( preferred ) and CBS_DROPDOWNLIST ( do not want to use ) has profound font differences when you want to disable the control with this syntax :
Code (fw): Select all Collapse
REDEFINE COMBOBOX oCategory  var cCategory  ID 153 of oCont ;
         ITEMS { "Contact Person","Sales Rep" } ;
         when cMode <> "V" COLOR CLR_BLACK,14869218

Here is the snipit from the Resource file with the style definitions for each example :
Code (fw): Select all Collapse
COMBOBOX 153, 78, 21, 181, 33, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP

Screen shot with CBS_DROPDOWN


and here is the same Resource with CBS_DROPDOWNLIST
Code (fw): Select all Collapse
COMBOBOX 153, 78, 21, 181, 33, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP

Screen shot with CBS_DROPDOWNLIST


I do not like the disabled font or appearance of the CBS_DROPDOWN however, I have chosen that style because I need to be able to Add or Edit a value not in the ITEM array.

Is there a way to work around on the disabled CBS_DROPDOWN to modify the text to look like the CBS_DROPDOWNLIST ?

I have tried to over-ride the font with oCategory:SetFont( oFont ) but it has no effect. Any help or advice would be appreciated.

Thanks
Rick Lipkin
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Sat Sep 29, 2012 05:19 PM
Try assigning the system font

Code (fw): Select all Collapse
DEFINE FONT oFont NAME GetSysFont() SIZE 0, -12


to the combobox.

EMG
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Mon Oct 01, 2012 01:16 PM
Enrico

I have tried your suggestion and applied the font to the Dialog
Code (fw): Select all Collapse
DEFINE FONT oFont NAME GetSysFont() SIZE 0, -12
...
...
DEFINE DIALOG oCont RESOURCE "CONTVIEW" ;
       TITLE xTITLE FONT oFont


as well as to the Combobox with no effect .. when you redefine a combobox from resource there is no 'font' option in FiveWin.ch, however there is a 'font' option if you create from code.
Code (fw): Select all Collapse
 REDEFINE COMBOBOX oCategory  var cCategory  ID 153 of oCont ;
   ITEMS { "Contact Person","Sales Rep","Accounting", "Technical Support", "Shipping Dept" } ;
         when cMode <> "V" //COLOR CLR_BLACK,14869218
   oCategory:SetFont( oFont )
   oCategory:SetColor(nRgb(7,7,224))


Please compile this sample code and you will see what I mean .. notice the difference in the two results .. the top is a Dropdown and the second is Dropdownlist.

Thanks
Rick Lipkin

Code (fw): Select all Collapse
#include "FiveWin.ch"

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

function Main()

   local oDlg, oCbx, cMode, cItem,oCbx1,cItem1

   cMode  := "V"
   cItem  := "Testing"
   cItem1 := "Testing"

   DEFINE DIALOG oDlg RESOURCE "TestCombo"

   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "Testing", "this", "ComboBox" } ;
      ID 110 OF oDlg when cMode <> "V"

   REDEFINE COMBOBOX oCbx1 VAR cItem1 ITEMS { "Testing", "this", "ComboBox" } ;
      ID 111 OF oDlg


   REDEFINE BUTTON ID 200 OF oDlg;
            ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil


TestCombo.rc
Code (fw): Select all Collapse
TestCombo DIALOG 49, 30, 124, 102
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Testing a ComboBox "
FONT 6, "MS Sans Serif"
{
 LTEXT "A ComboBox", -1, 10, 5, 43, 8
 COMBOBOX 110, 6, 16, 72, 31, CBS_DROPDOWN | WS_TABSTOP
 PUSHBUTTON "&End", 200, 86, 86, 33, 12
 COMBOBOX 111, 6, 45, 72, 31, CBS_DROPDOWNLIST | WS_TABSTOP
}


Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Mon Oct 01, 2012 01:44 PM
Code (fw): Select all Collapse
#include "FiveWin.ch"

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

function Main()

   local oDlg, oCbx, cMode, cItem,oCbx1,cItem1

   local oFont

   cMode  := "V"
   cItem  := "Testing"
   cItem1 := "Testing"

   DEFINE FONT oFont NAME GetSysFont() SIZE 0, -12

   DEFINE DIALOG oDlg RESOURCE "TestCombo"

   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "Testing", "this", "ComboBox" } ;
      ID 110 OF oDlg when cMode <> "V"

   oCbx:oGet:SetFont( oFont )

   REDEFINE COMBOBOX oCbx1 VAR cItem1 ITEMS { "Testing", "this", "ComboBox" } ;
      ID 111 OF oDlg

   REDEFINE BUTTON ID 200 OF oDlg;
            ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil


EMG
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Mon Oct 01, 2012 01:53 PM

Enrico

That worked .. never would have got that one without your help!!

Thanks
Rick Lipkin

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST
Posted: Mon Oct 01, 2012 03:07 PM

You're welcome, my friend! :-)

EMG

Continue the discussion