DCCOMBOBOX

This forum is for eXpress++ general support.
Post Reply
Message
Author
MIGUELON
Posts: 138
Joined: Wed Feb 10, 2010 10:55 am

DCCOMBOBOX

#1 Post by MIGUELON »

Hi everyone, does anyone know how I can disable pressing the up or down arrow when the focus is on a DCCOMBOBOX?
I want to be able to select only with the right button.
Regards and thanks for your help

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCCOMBOBOX

#2 Post by rdonnay »

It would require a change to express++ source code to allow a select from the right mouse button.
Do you also want to disable the left mouse button?
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 138
Joined: Wed Feb 10, 2010 10:55 am

Re: DCCOMBOBOX

#3 Post by MIGUELON »

Thanks for the reply Roger
I don't want to disable any mouse buttons I just want the Up or Down keys to not be able to select any option from the dccombobox array. I use Xbase 1.9

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCCOMBOBOX

#4 Post by rdonnay »

Here is an example of how to disable keys in the combobox using a custom event handler:

Code: Select all

#INCLUDE "dcdialog.ch"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, aComboCaptions, aComboValues, ;
      bGetSet, cComboCaption, nComboValue, oComboBox

aComboCaptions := { ;
    'Nineteen Ninety Seven' , ;
    'Nineteen Ninety Eight' , ;
    'Nineteen Ninety Nine' , ;
    'Two Thousand' , ;
    'Two Thousand One' , ;
    'Two Thousand Two' , ;
    'Two Thousand Three' , ;
    'Two Thousand Four' , ;
    'Two Thousand Five' }

aComboValues := { ;
    1997, ;
    1998, ;
    1999, ;
    2000, ;
    2001, ;
    2002, ;
    2003, ;
    2004, ;
    2005 }

cComboCaption := ''
nComboValue := 2002

@ 1,1 DCSAY 'Choose a year' SAYSIZE 0 SAYBOTTOM

bGetSet := DC_ComboGetSetBlock( aComboCaptions, aComboValues, ;
                                @cComboCaption, @nComboValue )

@ 1, DCGUI_COL + 10 DCCOMBOBOX bGetSet ;
       LIST aComboCaptions ;
       SIZE 20, 10 ;
       OBJECT oComboBox ;
       ITEMSELECTED DC_ComboSelectedBlock( aComboCaptions, aComboValues,  ;
                                           @cComboCaption, @nComboValue )

DCREAD GUI FIT ADDBUTTONS TITLE 'Combobox Test' HANDLER myHandler REFERENCE @oComboBox

DCMSGBOX 'You selected the year ' + Alltrim(Str(nComboValue))

RETURN nil

* ------------

PROC appsys
RETURN

* ------------

STATIC FUNCTION myHandler(nEvent,mp1,mp2,oXbp,oDlg,GetList,oComboBox)

IF nEvent == xbeP_Keyboard .AND. oXbp == oComboBox
  RETURN DCGUI_IGNORE
ENDIF

RETURN DCGUI_NONE
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 138
Joined: Wed Feb 10, 2010 10:55 am

Re: DCCOMBOBOX

#5 Post by MIGUELON »

Thank you very much Roger, this is the solution I was looking for.
I had a dccombobox and a dcbrowse in the same window, when I moved through the rows of the dcbrowse with the up or down keys it sometimes jumps to the dccombobox and starts selecting options from the array.
The problem is solved
:clap: :clap: :clap:

User avatar
SlavkoDam
Posts: 123
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: DCCOMBOBOX

#6 Post by SlavkoDam »

By your description, the cause of the problem is in dcbrowse and not in dccombobox???? You should handle dcbrowse keys and not dccombobox keys.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

Post Reply