FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Checkbox still strange
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 02:51 PM

Tim,

Have you tried linking in the ver 10.6 control.prg with the 10.7 FWH version. This would confirm that the problem is in the control.prg code and not elsewhere.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 06:49 PM

lTransparent is .t. for the keyclick.

I understand your question. I have to do this soft of evaluation all the time. Often a client has a problem I can't duplicate.

However, the reality is that something changed. If I simply substituted in the 10.06 control.prg, the problem goes away.

I am going to try adding in the changes one section at a time to the 10.06 code until the problem starts ... then I can tell you exactly !

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 07:21 PM

This is the offending code:

case nMsg == WM_LBUTTONDOWN
if ::lTransparent .and. ( ::IsKindOf( "TRADIO" ) .or. ::IsKindOf( "TCHECKBOX" ) )
::oWnd:Refresh( .f. )
endif
return ::LButtonDown( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )

The changes to WM_UPDATEUISTATE and the addition of WM_LBUTTONUP are fine. Howevever, with LBUTTONDOWN I'm having to double click the checkboxes. Also setting the default to lTransparent to .f. is not a problem. The only other change in the code was with the FOLDER, and that is not a problem.

So, the need to double click a checkbox is limited to the above addition made to 10.07. Any thoughts on why or what is wrong ?

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 07:55 PM
Try replacing

Code (fw): Select all Collapse
::oWnd:Refresh( .f. )


with

Code (fw): Select all Collapse
::oWnd:Refresh()


EMG
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 08:14 PM

It still requires a double click, but the flash returns !

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Tue Nov 09, 2010 09:27 PM

Ok. Is the problem solved without side effects if you completely remove the case WM_LBUTTONDOWN?

EMG

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 06:05 PM

James,

As you probably saw from the additional posts, I was able to isolate the problem to the WM_LBUTTONDOWN case in the event handler. Yes, it was added in 10.7, and not present in 10.6. All other changes in 10.7 were fine and did not cause a problem. Those same changes exist through 10.10.

EMG

Yes, if I comment out WM_LBUTTONDOWN from the 10.10 ( or previous ) version of FWH, then the problem goes away.

I'm wondering if there is a variable name in conflict in the classes. The problem is that this occurs consistently in some dialogs, on every checkbox. In other dialogs, it does not occur. It is always the same dialogs, and it is universal within them. That is why I can't give you a sample.

Why was the WM_LBUTTONDOWN added ? Perhaps I can better get this resolved if I knew the reason it was necessary in 10.7 when it worked fine without these changes in all previous versions. The solution to the problem probably lies within this reason.

Thanks.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 06:53 PM
Maybe this:

* Fix: samples\GradBrus.prg was failing when Alt was pressed or the mouse was clicked on a
radio or a checkbox. We have modified Class TControl Method HandleEvent() to solve it.


Can you try to take one of your dialogs showing the problem, extract it from your app, make the extracted code self-contained and then show us the resulting code?

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 07:11 PM
Tim,

CONTROL "Core", 750, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 80, 220, 40, 13


I still wonder about the above. What is a "core" control? Then it seems to be defined as both a button and a checkbox. Where did you get this syntax?

Perhaps your syntax was only working before because there was a bug in the FW code and now that the bug has been fixed it doesn't work.

I wonder why you are getting an error when trying to use a standard checkbox control. As Enrico mentioned, I think it would help if we could see the code for one of the dialogs that is giving you the problem. I would also like to see the preprocessor output.

You mentioned varaible name conflicts; are you using publics and/or privates?

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 07:24 PM
James Bott wrote:I still wonder about the above. What is a "core" control?


James, you have misunderstood: "Core" is the label, "Button" is the control type. :-)

EMG
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 08:22 PM
I did better then I thought.

Here is a "cut down" dialog

Code (fw): Select all Collapse
#INCLUDE "fivewin.ch"
#INCLUDE "tdata.ch"
#INCLUDE "wcolors.CH"
#INCLUDE "xbrowse.CH"


FUNCTION TestInv

    // Declare PRIVATE variables
    PRIVATE oDiw, oInv, oInvr, oLbxin                   // Main dialog object

    // Open the inventory database  and set the index to part number order
    oInv := tdata():new(, "einmst" )
    IF !oInv:use()
        MsgAlert( "Inventory file could not be opened" )
        RETURN nil
    ENDIF
    oInv:setorder( "einnum" )
    oInv:gotop()
  
  // Create the tRecord for editing
  oInvr:= TRecord():new( oInv )

    // Create the editor dialog
    DEFINE DIALOG oDiw RESOURCE "PRO2100" TRANSPARENT // BRUSH oBrush TRANSPARENT 

    REDEFINE CHECKBOX oInvr:invcof ID 750 OF oDiw ;
        MESSAGE "Does this part have cores attached ?" UPDATE
    REDEFINE CHECKBOX oInvr:invtxf ID 749 OF oDiw ;
        MESSAGE "Is this part generally taxable ?" UPDATE
    REDEFINE CHECKBOX oInvr:invtyp  ID 748 OF oDiw ;
        MESSAGE "Is this a stocking part ?"  UPDATE
    REDEFINE CHECKBOX oInvr:invapa ID 747 OF oDiw ;
        MESSAGE "Should there be a parts kit attached to this item ? " UPDATE
  
    // Create the browse control
    REDEFINE XBROWSE oLBxin ID 716 OF oDiw ON CHANGE ( oInvr:load(), oDiw:update() ) UPDATE
    oLbxin:setoDBF( oInv )
    add to oLbxin header "Part" data oInv:invnum ALIGN LEFT
    add to oLbxin Header "Description" data oInv:invdes ALIGN LEFT
    add to oLbxin header "Cross Ref." data oInv:invcod ALIGN LEFT
    add to oLbxin header "On Hand" data oInv:invstk ALIGN RIGHT PICTURE "9999.99"
    add to oLbxin Header "Charge" data oInv:invchg ALIGN RIGHT PICTURE "99,999.99"
    add to oLbxin Header "Location" data oInv:invloc ALIGN LEFT
    add to oLbxin Header "Manufacturer" data oInv:invman ALIGN LEFT

    // Activate the dialog screen
    ACTIVATE DIALOG oDiw ON PAINT oLbxin:setfocus() ON INIT ( oDiw:center(wndmain()) )
    
RETURN NIL


Code (fw): Select all Collapse
// RESOURCE SCRIPT FOR ASW9  Updated:  09/2009 to 11/2009

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "asw8.h"
#include "c:\fwh\include\WinApi.ch"

1 24 "WindowsXP.Manifest"

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

PRO2100 DIALOG DISCARDABLE 0, 0, 660, 175
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Checkbox Test Program"
FONT 8, "Arial"
BEGIN
  CONTROL "", 716, "TXBrowse", WS_TABSTOP|0x00a00000, 5, 30, 650, 135
  CONTROL "Tax", 749, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 10, 5, 40, 13
  CONTROL "Stock", 748, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 60, 5, 40, 13
  CONTROL "Core", 750, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 110, 5, 40, 13
  CONTROL "List", 747, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 160, 5, 32, 13
 
END


The code is built into an .exe using FWH 10.10 and xHabour ( xBuilder /xCC ). If I make the KEYDOWN change to Control.prg, it works fine. Without it, the checkboxes require a double click. I am using database objects and you will see an xBrowse also present.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 08:56 PM
I can't compile your sample but I see at least one error:

TimStone wrote:
Code (fw): Select all Collapse
ON PAINT oLbxin:setfocus()


What do you want to achieve using that line?

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 09:30 PM
Enrico,

James, you have misunderstood: "Core" is the label, "Button" is the control type.


OK, I see.

But why use a button as a ckeckbox?

Then he uses REDEFINE CHECKBOX in his code. Maybe this is a problem?

The Checkbox class is a subclass of TControl, so I don't understand the relationship with the button class.

I'm confused.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 09:45 PM
These two lines are equivalent:

Code (fw): Select all Collapse
CONTROL "Core", 750, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 80, 220, 40, 13

Code (fw): Select all Collapse
AUTOCHECKBOX "Core", 750, 80, 220, 40, 13, BS_AUTOCHECKBOX | WS_TABSTOP


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Checkbox still strange
Posted: Wed Nov 10, 2010 09:46 PM
James Bott wrote:But why use a button as a ckeckbox?


A checkbox is a kind of button.

EMG