Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Postby Rick Lipkin » Sat Sep 29, 2012 3: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: Select all  Expand view

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: Select all  Expand view

COMBOBOX 153, 78, 21, 181, 33, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
 

Screen shot with CBS_DROPDOWN
Image

and here is the same Resource with CBS_DROPDOWNLIST
Code: Select all  Expand view

COMBOBOX 153, 78, 21, 181, 33, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
 

Screen shot with CBS_DROPDOWNLIST
Image

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
User avatar
Rick Lipkin
 
Posts: 2658
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Postby Enrico Maria Giordano » Sat Sep 29, 2012 5:19 pm

Try assigning the system font

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


to the combobox.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8568
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Postby Rick Lipkin » Mon Oct 01, 2012 1:16 pm

Enrico

I have tried your suggestion and applied the font to the Dialog
Code: Select all  Expand view

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: Select all  Expand view

 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: Select all  Expand view

#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: Select all  Expand view

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
}
 


Image
User avatar
Rick Lipkin
 
Posts: 2658
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Postby Enrico Maria Giordano » Mon Oct 01, 2012 1:44 pm

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8568
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Combobox Diff with Style CBS_DROPDOWN and CBS_DROPDOWNLIST

Postby Rick Lipkin » Mon Oct 01, 2012 1:53 pm

Enrico

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

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2658
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 101 guests