bug in FW 13.04 combobox

Re: bug in FW 13.04 combobox

Postby ADutheil » Wed May 08, 2013 12:27 pm

Antonio,

I rebuilt fivehc32 with combobox.prg you sent me and everything seems to be working the way it used to till fwh1303. Thanks a lot. I noticed the size of fivehc32 grow after my rebuild. Did I do something wrong?
Code: Select all  Expand view
HARBOUR /n /iINCLUDE combobox
cl -TP -W3 -c /IINCLUDE /GA combobox.c
Lib C:\fwh\lib\Fivehc32.lib /OUT:C:\fwh\lib\Fivehc32.lib combobox.obj
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: bug in FW 13.04 combobox

Postby ADutheil » Thu May 09, 2013 11:34 pm

Antônio,

following code used to work until FWH1303

Code: Select all  Expand view
DEFINE DIALOG oDlg RESOURCE "CADFOLG" OF wndMain()
    REDEFINE COMBOBOX aGets[ 1 ]    VAR aVars[ 1 ] ITEMS aArea ID 101 OF oDlg
    REDEFINE COMBOBOX aGets[ 2 ]    VAR aVars[ 2 ] ITEMS aRota ID 102 OF oDlg UPDATE
    REDEFINE GET aGets[ 3 ]         VAR aVars[ 3 ] ID 103 OF oDlg
    REDEFINE COMBOBOX aGets[ 4 ]    VAR aVars[ 4 ] ITEMS aFolg ID 104 OF oDlg
    aGets[ 4 ]:oGet:bKeyDown = { | nKey | SearchItem( nKey, aGets[ 4 ] ) }
    REDEFINE BUTTON aButt[ 1 ] ID 1 DIALOG oDlg UPDATE ACTION if( lRetu, ( GravaFolg( aVars ), oDlg:end() ), NIL )
    REDEFINE BUTTON aButt[ 2 ] ID 2 DIALOG oDlg UPDATE ACTION oDlg:end() CANCEL
    aGets[ 1 ]:oGet:bValid := { || ( SeleRota( aVars[ 1 ], @aRota, .F. ), aGets[ 2 ]:SetItems( aRota ), aVars[ 2 ] := aRota[ 1 ], aGets[ 2 ]:refresh(), oDlg:aControls[ 2 ]:setFocus(), .T. ) } 
    aGets[ 1 ]:oGet:bChange := { || ( SeleRota( aVars[ 1 ], @aRota, .F. ), aGets[ 2 ]:SetItems( aRota ), aVars[ 2 ] := aRota[ 1 ], aGets[ 2 ]:refresh(), .T. ) }
    aGets[ 3 ]:bValid := { || if( VerifData( aVars ), ( aVars[ 4 ] := tira->ENTR, aGets[ 4 ]:refresh(), oDlg:aControls[ 4 ]:setFocus(), lRetu := .T., .T. ), ( lRetu := .F., .F. ) ) } 
    oDlg:lHelpIcon := .F.
ACTIVATE DIALOG oDlg
 


now I get an error.

Error BASE/1005 Nenhuma variável exportada: BVALID
Parameter :
[ 1] = U
[ 2] = B {|| ... }

Same happens with bChange.
Last edited by ADutheil on Fri May 10, 2013 4:35 pm, edited 1 time in total.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: bug in FW 13.04 combobox

Postby Mulyadi » Fri May 10, 2013 1:51 am

Antonio...

in my case, without change TCombobox all elements RC file originally CBS_DROPDOWNLIST must be change to CBS_DROPDOWN.

and now, after change TCombobox like your suggestion :

Code: Select all  Expand view

   * if lAnd( ::nStyle, CBS_DROPDOWN )    // originally

   if lAnd( ::nStyle, CBS_DROPDOWNLIST ) == CBS_DROPDOWN   // your suggestion
 


and all Style Combobox has back to originally, i get the error like this:

Application
===========
Path and name: e:\APPKsk\1304\fKsk.exe (32 bits)
Size: 3,643,392 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9656)
FiveWin Version: FWHX 13.03
Windows version: 6.1, Build 7600

Time from start: 0 hours 0 mins 9 secs
Error occurred at: 10-05-2013, 08:31:25
Error description: Error BASE/1070 Argument error: ==
Args:
[ 1] = L .T.
[ 2] = N 2

Stack Calls
===========
Called from: .\COMBOBOX.PRG => TCOMBOBOX:REDEFINE( 315 )
Called from: .\fAgroBKMUser.PRG => UPDT_FBKM( 1659 )
.
.
.


maybe you can send the file to me at: Mulyadi@ksk.co.id or mrmulyadi32@gmail.com
thanks....


Mulyadi
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Fri May 10, 2013 9:40 am

Mulyadi,

Please notice that I proposed nAnd() not lAnd():

if nAnd( ::nStyle, CBS_DROPDOWNLIST ) == CBS_DROPDOWN

You have used lAnd() thats why you get the error, comparing a logical value and a number
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Fri May 10, 2013 9:42 am

André,

Please change this line in your code:

REDEFINE COMBOBOX aGets[ 1 ] VAR aVars[ 1 ] ITEMS aArea ID 101 STYLE CBS_DROPDOWN OF oDlg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby ADutheil » Fri May 10, 2013 10:36 am

Antonio,

with the style classe it Works OK. But why is it needed as the COMBO is already DROPDOWN in RC?

Code: Select all  Expand view
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
DLGROTZON DIALOG 0, 0, 186, 95
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg"
{
    COMBOBOX        101, 30, 4, 153, 85, WS_TABSTOP | WS_VSCROLL | WS_BORDER | CBS_DROPDOWN | CBS_HASSTRINGS
    COMBOBOX        102, 30, 21, 153, 74, WS_TABSTOP | WS_VSCROLL | WS_BORDER | CBS_DROPDOWN | CBS_HASSTRINGS
    DEFPUSHBUTTON   "OK", IDOK, 33, 77, 50, 14
    PUSHBUTTON      "Cancelar", IDCANCEL, 103, 77, 50, 14
    LTEXT           "Área", -1, 3, 6, 16, 8, SS_LEFT
    LTEXT           "Roteiro", -1, 3, 23, 24, 8, SS_LEFT
}
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: bug in FW 13.04 combobox

Postby ADutheil » Fri May 10, 2013 12:09 pm

As all my COMBOs are built the same way it was easyer to tweak fivewin.ch than go through many PRGs. Cloned original COMBO definition to ALDCOMBO just in case I ever need another style.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Fri May 10, 2013 12:43 pm

André,

The reason for these changes is that not all the comboboxes styles use an embedded GET. CBS_DROPDOWNLIST does not use it.

But in Class TComboBox we were always creating the GET. Once we realized it, we have avoided to create it in those cases where it is not needed.

The problem is that when we do:

REDEFINE COMBOBOX ... ID ... OF ...

We don't know the real style of the combobox (as it is inside the resource) and the combobox does not get a valid windows handle until ACTIVATE DIALOG ... is executed. Meanwhile I am writing this, I think there is a way to solve it... going to review it (using FindResource() and LoadResource())
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Fri May 10, 2013 1:29 pm

I think I have found the right solution that does not break any existing code at all and does not require any changes in your PRGs :-)

This is the modified Method Redefine() for Class TCombobox:
Code: Select all  Expand view
METHOD ReDefine( nId, bSetGet, aItems, oWnd, nHelpId, bValid, ;
                 bChange, nClrFore, nClrBack, cMsg, lUpdate, ;
                 bWhen, acBitmaps, bDrawItem, nStyle, cPict, ;
                 bEChange ) CLASS TComboBox

   local hDlg, hCtrl

   DEFAULT oWnd := GetWndDefault()

   if nClrFore == nil
      nClrBack := GetSysColor( COLOR_WINDOW )
   endif

   DEFAULT aItems   := {},;
           nClrFore := GetSysColor( COLOR_WINDOWTEXT ),;
           lUpdate  := .f., ;
           nStyle   := CBS_DROPDOWNLIST

   ::nId       = nId
   ::hWnd      = 0
   ::aItems    = aItems
   ::bChange   = bChange
   ::bSetGet   = bSetGet
   ::oWnd      = oWnd
   ::nHelpId   = nHelpId
   ::bValid    = bValid
   ::nAt       = 0
   ::lDrag     = .f.
   ::lCaptured = .f.
   ::cMsg      = cMsg
   ::lUpdate   = lUpdate
   ::bWhen     = bWhen
   ::bDrawItem = bDrawItem
   ::nStyle    = nStyle
   ::cSearchKey = ""

   if acBitmaps != nil
      ::SetBitmaps( acBitmaps )
   else
      ::lOwnerDraw = .F.
   endif

   ::SetColor( nClrFore, nClrBack )
   
   if ( hDlg := CreateDlg( GetResources(), ::oWnd:cResName ) ) != 0
      if ( hCtrl := GetDlgItem( hDlg, ::nId ) ) != 0
         ::nStyle = GetWindowLong( hCtrl, GWL_STYLE )
      endif      
      DestroyWindow( hDlg )
   endif  

   if nAnd( ::nStyle, CBS_DROPDOWNLIST ) == CBS_DROPDOWN .or. ; // Not for CBS_DROPDOWNLIST
      nAnd( ::nStyle, CBS_DROPDOWNLIST ) == CBS_SIMPLE
      ::oGet := TGet():ReDefine( nil,    ;  // ID not used
                              ::bSetGet, ;  // bSETGET(uVar)
                              Self,      ;  // oDlg
                              ::nHelpID, ;  // Help Context ID
                              cPict,     ;  // Picture
                              nil,       ;  // Valid is handled by the CBx
                              ::nClrText,;
                              ::nClrPane,;
                              ::oFont,   ;  // <oFont>
                              nil,       ;  // <oCursor>
                              cMsg,      ;  // cMsg
                              nil,       ;  // <.update.>
                              nil,       ;  // <{uWhen}>
                              bEChange,  ;  // {|nKey,nFlags,Self| <uEChange>}
                              .F.        )  // <.readonly.> )
      ::oGet:bKeyChar = { | nKey | ::GetKeyChar( nKey ) }
   endif

   oWnd:DefControl( Self )

return Self
 


These lines make the magic :-)
Code: Select all  Expand view
  if ( hDlg := CreateDlg( GetResources(), ::oWnd:cResName ) ) != 0
      if ( hCtrl := GetDlgItem( hDlg, ::nId ) ) != 0
         ::nStyle = GetWindowLong( hCtrl, GWL_STYLE )
      endif      
      DestroyWindow( hDlg )
   endif  
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Fri May 10, 2013 2:10 pm

Now there is a new problem, the dialog does not shows automatically...

It seems that as we create a dialog in advance, this alters the focus sequence that Windows uses
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby elvira » Fri May 10, 2013 4:16 pm

Dear Antonio,

Please, do not break any existing code at all and do not require any changes in your PRGs.

Thanks a lot. I am willing to update to test xBrowse and SQLRDD, put we use combos very often.

Also, I see there is another bug in xBrowse in latest FW build.
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: bug in FW 13.04 combobox

Postby lucasdebeltran » Mon May 13, 2013 10:46 am

Hello Antonio,

Any update?.

Thank you.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug in FW 13.04 combobox

Postby Antonio Linares » Mon May 13, 2013 12:49 pm

Sadly, I think that we will have to revert this change as we can't create a dialog before our main dialog, or Windows understand that our dialog is not the main app dialog.

So I think that the solution is to create the GET always, no matter it if is not used at all on some cases (CBS_DROPDOWNLIST).

Any comments ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug in FW 13.04 combobox

Postby lucasdebeltran » Mon May 13, 2013 1:51 pm

Antonio,

Thank you.

Please, I would suggest to revert to 13.02, as in that version combos worked fine and also, once Mr. Nages solves the bug I pointed out and he confirmed by email he is working on it, to publish a revised build of FWH.

Thanks.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug in FW 13.04 combobox

Postby ADutheil » Mon May 13, 2013 1:53 pm

An unused get does not seem a big deal to me. Most of us certainly have a lot of forgotten unused variables in our prgs.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests