combobox issue

combobox issue

Postby Detlef » Thu Apr 14, 2022 10:07 pm

Dear all,

I have a problem when using a combobox.
Here my prg file:
Code: Select all  Expand view
#include "FiveWin.ch"

FUNCTION Main()
LOCAL aMwSt := { "19", "7", "0" }
LOCAL aTest   := aPosArtEdit( aMwSt, "19" )

   xbrowser( aTest )

RETURN( NIL )

FUNCTION aPosArtEdit( aMwSt, cPos )
LOCAL oDlg, oGet, cGet, oCbx, cCbx
LOCAL aItems := {}
LOCAL aRet   := {}

   XBROWSER aMwStSaetze TITLE "array given to function"

   cGet := "Leistung xyz"
   cCbx := padl( cPos, 2 ) + " %"

   aeval( aMwSt, { | u | aadd( aItems, padl( u, 2 ) + " %" ) } )

   XBROWSER aItems TITLE "array is now like this"
   msginfo( "looking for cCbx = " + cCbx + CRLF + CRLF + "found on array position : " + str( ascan( aItems, cCbx ) ) )

   DEFINE DIALOG oDlg NAME "EDIT_POS"

   REDEFINE GET oGet VAR cGet ID 10 OF oDlg
   REDEFINE COMBOBOX oCbx VAR cCbx ITEMS aItems ID 20 OF oDlg

   REDEFINE BUTTON ID 30 OF oDlg  ACTION ( aRet := { cGet, oCbx:nAt },  oDlg:End() )

   ACTIVATE DIALOG oDlg
RETURN( aRet )
 


And here my rc file:
Code: Select all  Expand view
#include <windows.h>
#include <commctrl.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
1 24 "WindowsXP.Manifest"

EDIT_POS DIALOG DISCARDABLE 6, 18, 322, 142
STYLE WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
CAPTION "Define MwSt"
FONT 10, "MS Sans Serif"
{
  CONTROL "Description", -1, "Static", WS_GROUP, 16, 28, 95, 8
  CONTROL "", 10, "Edit", WS_BORDER|WS_TABSTOP, 16, 40, 248, 12
  CONTROL "", 20, "ComboBox", WS_BORDER|CBS_DROPDOWN|CBS_SORT|WS_VSCROLL|WS_TABSTOP, 16, 72, 48, 52
  CONTROL "MwSt-Satz", -1, "Static", WS_GROUP, 16, 60, 40, 8
  CONTROL "speichern", 30, "Button", WS_TABSTOP, 208, 116, 48, 14
}
 


I can't find out why the combobox is showing the array items in reverse order.
Does anyone know this behaviour?

-Detlef
User avatar
Detlef
 
Posts: 206
Joined: Mon Feb 07, 2022 9:54 pm

Re: combobox issue

Postby Enrico Maria Giordano » Fri Apr 15, 2022 9:36 am

Just remove CBS_SORT from your RC file.

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

Re: combobox issue

Postby Detlef » Fri Apr 15, 2022 4:04 pm

Many thanks, Enrico.

I really should have read the rc file carefully. :oops:
-Detlef
User avatar
Detlef
 
Posts: 206
Joined: Mon Feb 07, 2022 9:54 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Silvio.Falconi and 43 guests