Page 1 of 1

BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 8:57 am
by Silvio.Falconi
I need to have two COMBOBOXes TYPE

local aElemento :={"Testo","Immagine","Barcode"}
local aTipoData :={"Campo","Valore"}
local nvar:=1
local nVar:=2

@ 8, 5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg TRANSPARENT
@ 8, 75 COMBOBOX aGet[1] VAR nVar1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg STYLE CBS_DROPDOWN
@ 24, 5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg TRANSPARENT
@ 22, 75 COMBOBOX aGet[2] VAR nVar2 ITEMS aTipoDATA SIZE 50,90 PIXEL OF oDlg STYLE CBS_DROPDOWN

I have always done so I don't understand why now oget_lostfocus makes a error

Code: Select all

  Error description: Error BASE/1072  Argument error: <>
   Args:
     [   1] = N   1
     [   2] = C   Testo

Stack Calls
===========
   Called from: .\source\classes\TGET.PRG => TGET:LOSTFOCUS( 2276 )
   Called from: .\source\classes\CONTROL.PRG => TGET:KILLFOCUS( 1150 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1790 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1221 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: test.prg => TEST( 36 )
what has been changed?


if I change the variable from numeric to text it makes me a strange error example

Code: Select all

#include "fivewin.ch"
#include "constant.ch"


Function Test()
       local oDlg,oBar,oFont,oBold
       local nBottom   := 24
       local nRight    := 102
       local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
       local nHeight := nBottom * DLG_CHARPIX_H
       local aGet[17]


       local aElemento :={"Testo","Immagine","Barcode"}
       local aTipoData :={"Campo","Valore"}
       local cDescrizione:=space(40)
       local cItem1    := aElemento[ 1 ]
       local cItem2    := aTipoData[ 1 ]
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg        ;
   TITLE "Riga modulo"     ;
   SIZE nWidth, nHeight   PIXEL  FONT oFont    ;
   STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 ) ;
   COLOR CLR_BLACK,  nRgb( 245,244,234)


       @ 8, 5 Say "Tipo Elemento "  SIZE 80,14 PIXEL OF oDlg  TRANSPARENT
       @ 8, 75 COMBOBOX aGet[1] VAR cItem1  ITEMS aElemento  SIZE 50,90 PIXEL OF oDlg    STYLE CBS_DROPDOWN

       @ 24, 5 Say "Tipo Dato "  SIZE 80,14 PIXEL OF oDlg  TRANSPARENT
       @ 22, 75 COMBOBOX aGet[2] VAR cItem2  ITEMS aTipoDATA  SIZE 50,90 PIXEL OF oDlg    STYLE CBS_DROPDOWN

 ACTIVATE DIALOG oDlg CENTERED ;
       ON INIT ( aGet[1]:oGet:SetSel(), aGet[2]:oGet:SetSel())
 RETURN NIL

 
if you play with the two comboboxes, sometimes the word "campo" becomes "campoe"
or the word "barcode" becomes "barcodee"


why don't you fix this bug?

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 3:33 pm
by nageswaragunupudi
why don't you fix this bug?
If there is a bug, we can fix.
There is no bug in the libs.

You please check your program.

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 4:37 pm
by Massimo Linossi
nageswaragunupudi wrote:
why don't you fix this bug?
If there is a bug, we can fix.
There is no bug in the libs.

You please check your program.
Image

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 5:34 pm
by Silvio.Falconi
good Mr Linossi teacher of Fwh

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 5:59 pm
by Otto
Hello Silvio,
you assign a numeric variable to a character.
If you need the numeric, the position in the array you should use aGet[1]:nAt.

@ 8, 75 COMBOBOX aGet[1] VAR cItem1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg STYLE CBS_DROPDOWN ON CHANGE msginfo( aGet[1]:nAt )

Best regards,
Otto

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 6:50 pm
by Silvio.Falconi
that is only a sample because numeric test not run ok
now I resolved with
nTipoData:= 1

@ 24, 5 Say "Dato da Stampare" SIZE 90,20 PIXEL OF oDlg TRANSPARENT
@ 22, 75 COMBOBOX aGet[2] VAR nTipoData ITEMS aDataPrint SIZE 50,90 PIXEL OF oDlg;
ON CHANGE ( IIF( nTipoData=2,;
(aGet[3]:hide(),aGet[4]:show(), ;
aGet[4]:setFocus(),;
oBtn1:Hide(),oBtn2:Hide(),oBtn3:Hide()),;
(aGet[4]:hide(),aGet[3]:show(), ;
aGet[3]:setFocus(),;
oBtn1:Show(),oBtn2:Show(),oBtn3:Show() ) ) )

as you can see here

Image

Re: BUG COMBOBOX ?????

Posted: Sat Oct 31, 2020 7:33 pm
by Silvio.Falconi
Massimo Linossi wrote:
nageswaragunupudi wrote:
why don't you fix this bug?
If there is a bug, we can fix.
There is no bug in the libs.

You please check your program.
Image


before criticizing myself and continuing to offend me with this gif, carefully read this topic http://forums.fivetechsupport.com/viewt ... ox#p228031
and the solution made by Antonino Perricone for combobox control
If Antonino Perricone has created a new class it means that the parent class has problems

Re: BUG COMBOBOX ?????

Posted: Sun Nov 01, 2020 12:34 am
by nageswaragunupudi

Code: Select all

the parent class has problems
There are no problems.
You just need to know how to use the class.

Re: BUG COMBOBOX ?????

Posted: Sun Nov 01, 2020 10:14 am
by Silvio.Falconi
nageswaragunupudi wrote:

Code: Select all

the parent class has problems
There are no problems.
You just need to know how to use the class.
I respect you and I don't want to keep fueling discussions with you let's do this I start studying the classes, I just copied an old source of an old program that I didn't do and I recompiled it and it doesn't work with the current version of fwh, there is someone who enjoys modify the object classes to drive us crazy to find the errors and changes made: do I have to list all those classes that over time have been changed for the worse? For example I use a version of the rpreview class but with override comands because the current version has problems and this is not just me but also famous people who are in the breach long before you

Re: BUG COMBOBOX ?????

Posted: Sun Nov 01, 2020 12:37 pm
by nageswaragunupudi
Using Combobox:

1) With Numeric Variables:
When using numeric variables, we should NOT use CBS_DROPDOWN style.
Sample:

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg
   local aElemento   :={ "Testo","Immagine","Barcode" }
   local aTipoData   :={ "Campo","Valore"}
   local nvar1       := 1
   local nVar2       := 2
   local aGet[ 2 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR nVar1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg
   @ 24,  5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 COMBOBOX aGet[2] VAR nVar2 ITEMS aTipoDATA SIZE 50,90 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

   ? aElemento[ nVar1 ], aTipoData[ nVar2 ]

return nil
 
2)(a) Using Character Variables without CBS_DROPDOWN style.
In this case, user can select one of the options but can not enter a different value manually like in a Get.

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg
   local aElemento   :={ "Testo","Immagine","Barcode" }
   local aTipoData   :={ "Campo","Valore" }
   local cvar1       := "Testo"
   local cVar2       := "Valore"
   local aGet[ 2 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR cVar1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg
   @ 24,  5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 COMBOBOX aGet[2] VAR cVar2 ITEMS aTipoDATA SIZE 50,90 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

   ? cVar1, cVar2

return nil
 
2)(b) Using Character Variables with CBS_DROPDOWN style:
In this case, user can select one of the options or enter a different value in the Get.

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg
   local aElemento   :={ "Testo","Immagine","Barcode" }
   local aTipoData   :={ "Campo","Valore" }
   local cvar1       := "Testo"
   local cVar2       := "Valore"
   local aGet[ 2 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR cVar1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg STYLE CBS_DROPDOWN
   @ 24,  5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 COMBOBOX aGet[2] VAR cVar2 ITEMS aTipoDATA SIZE 50,90 PIXEL OF oDlg STYLE CBS_DROPDOWN

   ACTIVATE DIALOG oDlg CENTERED

   ? cVar1, cVar2

return nil
 
Please follow these guidelines and you will not get any error.

Re: BUG COMBOBOX ?????

Posted: Sun Nov 01, 2020 1:03 pm
by Silvio.Falconi

Re: BUG COMBOBOX ?????

Posted: Mon Nov 02, 2020 12:30 am
by Otto
Hello Silvio,

Funny I am working right now on a similar program - but for mod harbour.
Same components: Font size, color picker, checkbox, icon selector.


Best regards
Otto

Image

Image

Image

Re: BUG COMBOBOX ?????

Posted: Tue Nov 03, 2020 11:41 am
by Silvio.Falconi
[quote="nageswaragunupudi"]Using Combobox:

1) With Numeric Variables:
When using numeric variables, we should NOT use CBS_DROPDOWN style.
Sample:

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg
   local aElemento   :={ "Testo","Immagine","Barcode" }
   local aTipoData   :={ "Campo","Valore"}
   local nvar1       := 1
   local nVar2       := 2
   local aGet[ 2 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR nVar1 ITEMS aElemento SIZE 50,90 PIXEL OF oDlg
   @ 24,  5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 COMBOBOX aGet[2] VAR nVar2 ITEMS aTipoDATA SIZE 50,90 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

   ? aElemento[ nVar1 ], aTipoData[ nVar2 ]

return nil
 


Nages,

my dialog is more complex of your sample


Image




I use nTipoElemento and nTipodata as numeric for the combox

but I take the data from a dbf where I have two field

1. text ( 1CR)
2. Logic

Code: Select all


#include "fivewin.ch"

Function Main()

   local oDlg, oBrw, oFont

   USE FORMATI ALIAS FO

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 740,440 PIXEL ;
      FONT oFont TITLE 'test'

   @ 40, 10 XBROWSE oBrw OF oDlg SIZE 350, 90 PIXEL ;
      AUTOCOLS ALIAS 'FO' NOBORDER

   oBrw:nMarqueeStyle    = MARQSTYLE_HIGHLWIN7
   oBrw:CreateFromCode()

   
   @195,45 Button "Modifica" OF oDlg SIZE 30, 12 PIXEL ACTION Edit(2)

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil



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

function Edit(nMode)

   local oDlg
   local oBtnSel[3]
   local aElemento   :={ "Testo","Immagine","Barcode" }
   local aTipoData   :={ "Campo","Valore"}
   local aGet[ 17 ]

   local nTipoElemento ,;
         nTipoDato     ,;
         cDesc         
         


   nTipoElemento :=IIF(FO->Tipo=="T",1,IIF(FO->Tipo=="I",2,3))
   nTipoDato        :=IIF(FO->Campo,1,2)
   cDesc               :=FO->Testo
   
  
   DEFINE DIALOG oDlg SIZE 900,200 PIXEL

   @  8,  5 Say "Tipo Elemento " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR nTipoElemento ITEMS aElemento SIZE 50,90 PIXEL OF oDlg


   @ 24,  5 Say "Tipo Dato " SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 COMBOBOX aGet[2] VAR nTipoDato ITEMS  aTipoData  SIZE 50,90 PIXEL OF oDlg ;
                ON CHANGE  ( IIF(nTipoDato=2,;
                        (aGet[3]:hide(),aGet[4]:show(), ;
                           oBtnsel[1]:Hide(),oBtnsel[2]:Hide(),oBtnSel[3]:Hide()),;
                        (aGet[3]:show(),aGet[4]:hide(),;
                           oBtnSel[1]:Show(),oBtnSel[2]:Show(),oBtnSel[3]:Show() ) ) )


    @ 22, 130  GET aGet[3] VAR cDesc      SIZE 220,12 PIXEL OF oDlg  WHEN nTipoDato=1   UPDATE
    @ 22, 130  GET aGet[4] VAR cDesc MEMO SIZE 270,30 PIXEL OF oDlg  WHEN nTipoDato=2   UPDATE


    @ 22, 352 BTNBMP oBtnSel[1]  RESOURCE "REP_CARICA";
              FLAT SIZE 15, 12  OF oDlg   PIXEL ;
              ACTION NIL  COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
              TOOLTIP "Carica campo"

    @ 22, 369 BTNBMP oBtnSel[2]  RESOURCE "REP_SVUOTA" ;
              FLAT SIZE 15, 12  OF oDlg PIXEL  ;
              ACTION NIL  ;
              COLOR  nRgb(238,236,219),nRgb(238,236,219);
              TOOLTIP "Svuota"

    @ 22, 386 BTNBMP oBtnSel[3]  RESOURCE "BNT_VUOTO"  ;
              FLAT SIZE 15, 12 OF oDlg PIXEL    ACTION NIL  ;
              COLOR  nRgb(238,236,219),nRgb(238,236,219)



    ACTIVATE DIALOG oDlg CENTERED;
     ON INIT (  nTipoDato:=2, aGet[2]:refresh(),;
                 oBtnSel[1]:Hide(),oBtnSel[2]:Hide(),oBtnSel[3]:Hide()  )


   ? aElemento[ nTipoElemento ], aTipoData[ nTipoDato]

return nil
 


When the nTipoDato=2 it show the get (4) with Memo and you can edit it ,

when nTipoDato=1 it show the normal get but you cannot edit it

then if I press ESC it make error on this lines


@ 22, 130 GET aGet[3] VAR cDesc SIZE 220,12 PIXEL OF oDlg WHEN nTipoDato=1 UPDATE

@ 22, 130 GET aGet[4] VAR cDesc MEMO SIZE 270,30 PIXEL OF oDlg WHEN nTipoDato=2 UPDATE


why I cannet edit the gets? and sometimes I have also oget:lostfocus error I don't Know why