Page 1 of 3
Problems with Checkbox
Posted: Thu May 05, 2011 9:46 pm
by reinaldocrespo
Hi.
I have noticed that on some dialogs the presence of a checkbox erases part of the dialog. Look at his snapshots:
and then after clicking on the checkmark:
Notice how before clicking the other 2 checkboxes were erased as well as part of the border of the dialog.
This happens a lot with checkboxes on dialogs from resources. Is there a fix?
Reinaldo.
Re: Problems with Checkbox
Posted: Fri May 06, 2011 7:38 am
by Richard Chidiak
Reinaldo
I have the same problem
If you are using win 7 , a workaround for this is to change the shortcut for your application and at compatibility level, set "avoid display effects" (sorry for translation, but you will find)
A side effect, apps are not themed anymore. We definitely need a fix for this.
PS : for Antonio, the problem only occurs when you hide some controls at init display
Hth
Richard
Re: Problems with Checkbox
Posted: Fri May 06, 2011 10:58 am
by Carles
R,
Can u try ?
Code: Select all
Put in main.prg
FUNCTION IsAppThemed()
RETU .F.
Re: Problems with Checkbox
Posted: Fri May 06, 2011 11:16 am
by Richard Chidiak
Carles
I have tried it before and it works BUT There will be no more themes in the application ! So it is not an acceptable solution. Better change the shortcut when necessary (it does the same without changing the program).
We need a fix for the bug. Antonio ?
Richard
Re: Problems with Checkbox
Posted: Fri May 06, 2011 11:41 am
by reinaldocrespo
Richard / Carles;
Hi. Thank you for the reply. Changing the return value of IsAppThemed() has side effects as dialogs become dull, thus it is not an acceptable solution. Changing the shortcut values or telling all users to do so, would be a hassle plus users will conclude that the app is not totally compatible with win7.
I can't imagine that all fw users must live with the problem.... ? What is everyone else doing? Should we avoid using checkboxes?
Reinaldo.
Re: Problems with Checkbox
Posted: Fri May 06, 2011 1:35 pm
by Enrico Maria Giordano
reinaldocrespo wrote:I can't imagine that all fw users must live with the problem.... ? What is everyone else doing?
I never notice such problem in my apps. Can you build a reduced sample showing the problem?
EMG
Re: Problems with Checkbox
Posted: Fri May 06, 2011 1:52 pm
by Richard Chidiak
Enrico
try the following sample that shows the problem , i am running on windows 7
Code: Select all
#include "fivewin.ch"
FUNCTION MAIN()
LOCAL oChk1 := .F., ;
oChk2 := .F., ;
oChk3 := .F., ;
oChk4 := .F., ;
oChk5 := .F., ;
ODLG,OBJ1,OBJ2
DEFINE DIALOG ODLG RESOURCE "TEST3" COLORS CLR_BLACK,CLR_BLUE TRANSPARENT
REDEFINE CHECKBOX OBJ1 VAR OCHK1 ID 201 OF ODLG COLOR CLR_GREEN
REDEFINE CHECKBOX OBJ2 VAR OCHK2 ID 202 OF ODLG COLOR CLR_GREEN
REDEFINE CHECKBOX OCHK3 ID 203 OF ODLG COLOR CLR_GREEN
REDEFINE CHECKBOX OCHK4 ID 204 OF ODLG COLOR CLR_GREEN
REDEFINE CHECKBOX OCHK5 ID 205 OF ODLG COLOR CLR_GREEN
REDEFINE BUTTON ID 01 OF ODLG ACTION ODLG:END()
REDEFINE BUTTON ID 02 OF ODLG ACTION ODLG:END()
ACTIVATE DIALOG ODLG CENTERED ON INIT(OBJ1:HIDE())
RETURN NIL
resource
Code: Select all
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 5.00".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
TEST3 DIALOG DISCARDABLE 9, 16, 232, 132
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "CHECKBOX TEST"
FONT 10, "Tahoma"
{
CONTROL "CHECKBOX 1", 201, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 4, 8, 108, 9, WS_EX_TRANSPARENT
CONTROL "OK", IDOK, "Button", BS_DEFPUSHBUTTON|WS_TABSTOP, 0, 104, 42, 21
CONTROL "Annuler", IDCANCEL, "Button", WS_TABSTOP, 188, 104, 42, 21
CONTROL "CHECKBOX 2", 202, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 4, 24, 108, 9, WS_EX_TRANSPARENT
CONTROL "CHECKBOX 3", 203, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 4, 40, 108, 9, WS_EX_TRANSPARENT
CONTROL "CHECKBOX 4", 204, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 0, 56, 108, 9, WS_EX_TRANSPARENT
CONTROL "CHECKBOX 5", 205, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 0, 72, 108, 9, WS_EX_TRANSPARENT
}
Re: Problems with Checkbox
Posted: Fri May 06, 2011 5:30 pm
by Silvio
I modify control.prg
seek checkbox on this forum please I saw the modifies of linares here
Re: Problems with Checkbox
Posted: Sat May 07, 2011 1:38 pm
by Richard Chidiak
The modifications of control.prg are included in fwh 11.04 an the problem is still there
It is not related to transparency, removing all transparents clausus from program and resources will make the dialog flicker less but still flickers
There is a serious bug in checkbox.
Antonio can you help ?
Thank you
Richard
Re: Problems with Checkbox
Posted: Sat May 07, 2011 3:21 pm
by Enrico Maria Giordano
There's something wrong in your sample. This is a working sample:
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oCk1, lCk1 := .F.
LOCAL oCk2, lCk2 := .F.
LOCAL oCk3, lCk3 := .F.
DEFINE DIALOG oDlg;
RESOURCE "TEST";
COLOR CLR_BLACK, CLR_BLUE;
TRANSPARENT
REDEFINE CHECKBOX oCk1 VAR lCk1;
ID 101 OF oDlg;
COLOR CLR_GREEN
REDEFINE CHECKBOX oCk2 VAR lCk2;
ID 102 OF oDlg;
COLOR CLR_GREEN
REDEFINE CHECKBOX oCk3 VAR lCk3;
ID 103 OF oDlg;
COLOR CLR_GREEN
ACTIVATE DIALOG oDlg;
ON INIT oCk1:Hide();
CENTER
RETURN NIL
Code: Select all
TEST DIALOG 37, 56, 158, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
CONTROL "Test 1:", 101, "BUTTON", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 10, 35, 12
CONTROL "Test 2:", 102, "BUTTON", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 25, 35, 12
CONTROL "Test 3:", 103, "BUTTON", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 40, 35, 12
}
EMG
Re: Problems with Checkbox
Posted: Sun May 08, 2011 5:01 pm
by Enrico Maria Giordano
Ok, I can reproduce the problem when the manifest is not linked in. Try to add
inside checkbox.prg and test it in all the conditions, please.
EMG
Re: Problems with Checkbox
Posted: Sun May 08, 2011 6:41 pm
by Richard Chidiak
Enrico
Thanks for your help
It occurs even if the manifest is linked in , especially under win7 64 with aero theme (standard pc's today)
I have changed control.prg and now i have it working in all cases, only one side effect with skinbuttons ... but il can live without skinbuttons
i will test the change to checkbox also as it makes sense,
Thanks again
Richard
Re: Problems with Checkbox
Posted: Sun May 08, 2011 7:04 pm
by Richard Chidiak
Enrico
Your solution is OK , no need to change control.prg
Hopefully Antonio will change checkbox.prg for further release , so we will not have to worry about it
Best regards
Re: Problems with Checkbox
Posted: Sun May 08, 2011 7:22 pm
by carlos vargas
for xharbour only
this variant is for not modify the checkbox.prg
add in you project
Code: Select all
...
EXTEND CLASS TCHECKBOX WITH METHOD MyHandleEvent
...
STATIC FUNCTION MyHandleEvent()
LOCAl Self := HB_QSelf()
RETURN NIL
Re: Problems with Checkbox
Posted: Sun May 08, 2011 9:12 pm
by Enrico Maria Giordano
Richard Chidiak wrote:Enrico
Your solution is OK , no need to change control.prg
Hopefully Antonio will change checkbox.prg for further release , so we will not have to worry about it
Best regards
I just fixed checkbox.prg in the FWH SVN.
EMG