how display item superior width ComboBox ?

Post Reply
User avatar
ericmagaldi
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil
Contact:

how display item superior width ComboBox ?

Post by ericmagaldi »

Hi.

how display item superior it width ComboBox (open) ?
http://br.geocities.com/ericmagaldi/screen/combobox.jpg

I use Pelles C.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Éric,

I don't understand your question. Why don't you increase its width ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ericmagaldi
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil
Contact:

Post by ericmagaldi »

Antonio Linares wrote:Why don't you increase its width ?
LayOut and not need adjust for every item insert.

While it is closed, not need display all character, but during choose (Open), is much important (+informative).

Is possible ???
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil
Contact:

Post by ericmagaldi »

aff !! never yet one "YES" or "NO" POSSIBLE ?????!!!!!

alternative temporary in my Class:

Code: Select all

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS MComboBox

if nMsg == FM_CLOSEUP
   ::cToolTip:=::varget()

   return ::CloseUp()
endif
return Super:HandleEvent( nMsg, nWParam, nLParam )

virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Eric,

Sometimes we don't answer a question when we don't get enough information in the question, sorry

Do you mean that you want to increase the width of the shown dropdown list ? If so, then please review the API docs for these two listbox messages, in case that they may help:

#define LB_SETHORIZONTALEXTENT 0x0194
#define LB_SETCOLUMNWIDTH 0x0195
Last edited by Antonio Linares on Wed Dec 05, 2007 9:10 am, edited 2 times in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

If I understood correctly, you want the list part of the combobox to be wider than the edit part. I don't think this is possible, at least using the standard comboboxes.

EMG
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá Eric,

Veja se este exemplo faz o que você precisa:

Code: Select all


#include "FiveWin.ch"

#define COMBO_BASE             320
#define CB_SETITEMHEIGTH      ( COMBO_BASE + 19 )
#define CB_GETITEMHEIGTH      ( COMBO_BASE + 20 )

#define CB_SETDROPPEDWIDTH     0x0160
#define CB_GETDROPPEDWIDTH     ( COMBO_BASE + 25 )

function Main()

   local oDlg, oCbx
   local aEstados := { "AC   Acre", "AL   Alagoas", "AM   Amazônia", "AP   Amapá", "BA   Bahia", "CE   Ceará", "DF   Distrito Federal", "ES   Espirito Santo", "EX   Exterior", "GO   Goias", "MA   Maranhão", "MG   Minas Gerais", "MS   Mato Grosso Sul", "MT   Mato Grosso", "PA   Pará", "PB   Paraiba", "PE   Pernambuco", "PI   Piauí", "PR   Paraná", "RJ   Rio de Janeiro", "RN   Rio Grande Norte", "RO   Rondônia", "RR   Roraima", "RS   Rio Grande Sul", "SC   Santa Catarina", "SE   Sergipe", "SP   São Paulo", "TO   Tocantins" }
   local cText    := aEstados[1]

* Aqui voce retorna a altura da linha do combobox, quando ele esta aberto
   extend class TCombobox with message getItemheight( nItem )          inline ::SendMsg( CB_GETITEMHEIGTH, nItem, 0 )

* Aqui voce define a altura da linha do combobox, quando ele esta aberto
   extend class TCombobox with message setItemheight( nHeight ) inline ::SendMsg( CB_SETITEMHEIGTH, , nHeight )

* Aqui voce retorna a largura da linha do combobox, quando ele esta aberto
   extend class TCombobox with message GETDROPPEDWIDTH()               inline ::SendMsg( CB_GETDROPPEDWIDTH, 0, 0 )

* Aqui voce define a largura da linha do combobox, quando ele esta aberto
   extend class TCombobox with message SETDROPPEDWIDTH( nWidth )       inline ::SendMsg( CB_SETDROPPEDWIDTH, nWidth, 0 )

   DEFINE DIALOG oDlg FROM 0, 0 TO 200, 200 ;
      TITLE "DropDown ComboBox Test" pixel

   @ 10, 10 COMBOBOX oCbx VAR cText STYLE CBS_DROPDOWNLIST ;  && CBS_DROPDOWN ;
     ITEMS aEstados size 20, 100 ;
      ON CHANGE oDlg:SetText( cText ) pixel

   oCbx:bgotfocus := { |oObj| ( oObj:setItemheight( 20 ), oObj:setdroppedwidth( 200 ), oObj:refresh() ) }

   ACTIVATE DIALOG oDlg CENTERED

return nil

Abraços,

Rossine.
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Could you please post this in English, too.
Do we need a changed tComboBox?
Thanks for your code
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rossine,

many thanks! :-)

I wrongly thought about a listbox and it is a combobox :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Rossine wrote:Veja se este exemplo faz o que você precisa:
Wonderful!

EMG
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Hello Otto,
Do we need a changed tComboBox?
Not. Only include this stretch in his file .PRG main:

Code: Select all

   extend class TCombobox with message getItemheight( nItem )          inline ::SendMsg( CB_GETITEMHEIGTH, nItem, 0 ) 

   extend class TCombobox with message setItemheight( nHeight ) inline ::SendMsg( CB_SETITEMHEIGTH, , nHeight ) 

   extend class TCombobox with message GETDROPPEDWIDTH()               inline ::SendMsg( CB_GETDROPPEDWIDTH, 0, 0 ) 

   extend class TCombobox with message SETDROPPEDWIDTH( nWidth )       inline ::SendMsg( CB_SETDROPPEDWIDTH, nWidth, 0 ) 

Here the example translated into the English:

Code: Select all

#include "FiveWin.ch" 

#define COMBO_BASE             320 
#define CB_SETITEMHEIGTH      ( COMBO_BASE + 19 ) 
#define CB_GETITEMHEIGTH      ( COMBO_BASE + 20 ) 

#define CB_SETDROPPEDWIDTH     0x0160 
#define CB_GETDROPPEDWIDTH     ( COMBO_BASE + 25 ) 

function Main() 

   local oDlg, oCbx 
   local aEstados := { "AC   Acre", "AL   Alagoas", "AM   Amazônia", "AP   Amapá", "BA   Bahia", "CE   Ceará", "DF   Distrito Federal", "ES   Espirito Santo", "EX   Exterior", "GO   Goias", "MA   Maranhão", "MG   Minas Gerais", "MS   Mato Grosso Sul", "MT   Mato Grosso", "PA   Pará", "PB   Paraiba", "PE   Pernambuco", "PI   Piauí", "PR   Paraná", "RJ   Rio de Janeiro", "RN   Rio Grande Norte", "RO   Rondônia", "RR   Roraima", "RS   Rio Grande Sul", "SC   Santa Catarina", "SE   Sergipe", "SP   São Paulo", "TO   Tocantins" } 
   local cText    := aEstados[1] 

* Here you return the height of the line of the combobox, when he is open
   extend class TCombobox with message getItemheight( nItem )          inline ::SendMsg( CB_GETITEMHEIGTH, nItem, 0 ) 

* Here you defined the height of the line of the combobox, when he is open
   extend class TCombobox with message setItemheight( nHeight ) inline ::SendMsg( CB_SETITEMHEIGTH, , nHeight ) 

* Here you return the width of the line of the combobox, when he is open
   extend class TCombobox with message GETDROPPEDWIDTH()               inline ::SendMsg( CB_GETDROPPEDWIDTH, 0, 0 ) 

* Here you defined the width of the line of the combobox, when he is open
   extend class TCombobox with message SETDROPPEDWIDTH( nWidth )       inline ::SendMsg( CB_SETDROPPEDWIDTH, nWidth, 0 ) 

   DEFINE DIALOG oDlg FROM 0, 0 TO 200, 200 ; 
      TITLE "DropDown ComboBox Test" pixel 

   @ 10, 10 COMBOBOX oCbx VAR cText STYLE CBS_DROPDOWNLIST ;  && CBS_DROPDOWN ; 
     ITEMS aEstados size 20, 100 ; 
      ON CHANGE oDlg:SetText( cText ) pixel 

   oCbx:bgotfocus := { |oObj| ( oObj:setItemheight( 20 ), oObj:setdroppedwidth( 200 ), oObj:refresh() ) } 

   ACTIVATE DIALOG oDlg CENTERED 

return nil 
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Rossine,
trying to compile I get this error: I use Harbour.
Regards.
Otto

No code generated
14comobox.prg(22) Error E0030 Syntax error: "syntax error at 'CLASS'"
14comobox.prg(25) Error E0030 Syntax error: "syntax error at 'CLASS'"
14comobox.prg(28) Error E0030 Syntax error: "syntax error at 'CLASS'"
14comobox.prg(31) Error E0030 Syntax error: "syntax error at 'CLASS'"
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Error E2194: Could not find file '14comobox.c'
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Post by carlos vargas »

sorry for my bad english

The EXTENDED CLASS ... is a extencion for xHarbour Only.

:-(

salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

You can replace the new methods with simple functions and pass them the combobox object variable.

EMG
Post Reply