Page 1 of 1
bOr / nOr : how to "add" Constante under FiveWin
Posted: Mon Oct 17, 2022 5:53 am
by Jimmy
hi,
to set different Constante under Xbase++ i use
Code: Select all | Expand
::oLVCol:mask := nOr( LVCF_FMT, LVCF_WIDTH , LVCF_TEXT , LVCF_SUBITEM )
i know i can "add" Constante this Way
Code: Select all | Expand
::oLVCol:mask := LVCF_FMT + LVCF_WIDTH + LVCF_TEXT + LVCF_SUBITEM
but i like to know how under FiveWin
p.s. can use use hbxpp Constribution under FivWin ?
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Mon Oct 17, 2022 6:44 am
by Antonio Linares
Dear Jimmy,
FWH also provides a function nOr() you can use the same way. Also you can use Harbour's own function hb_bitOr()
> ::oLVCol:mask := LVCF_FMT + LVCF_WIDTH + LVCF_TEXT + LVCF_SUBITEM
You can't use it that way as OR is a different process from adding those values
> p.s. can use use hbxpp Constribution under FiveWin ?
I don't think so, but anyhow please try to link it and lets see what unresolved externals you get
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Mon Oct 17, 2022 11:00 am
by nageswaragunupudi
For flags we better use OR not +
OR vs +
1 OR 2 = 3
1 + 2 = 3 // OK
1 OR 1 = 1
1 + 1 = 2 // NOT OK
3 OR 6 = 7 ( binary 011 OR 110 = 111 )
3 + 6 = 9 // NOT OK
Ways to use "OR"
( a | b | c ...) // clang
nOr( a, b, ... ) // FWH function
NUMOR( a, b, .. ) // CT function
HB_BITOR( a, b ) // xHarbour 2 params only
HB_BITOR( a, b, c, ... ) // Harbour
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 1:27 am
by Jimmy
hi,
i wonder ...
Code: Select all | Expand
#define LVCF_FMT 0x01
#define LVCF_SUBITEM 0x08
#define LVCF_TEXT 0x04
#define LVCF_WIDTH 0x02
PROCEDURE TEST
LOCAL nTest1,nTest2
nTest1 := nor(LVCF_FMT,LVCF_WIDTH,LVCF_TEXT,LVCF_SUBITEM)
nTest2 := LVCF_FMT + LVCF_WIDTH + LVCF_TEXT + LVCF_SUBITEM
msgInfo(STR(nTest1)+" vs. "+STR(nTest2),IF(nTest1==nTest2,"True","False"))
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 8:07 am
by Jimmy
hi,
i want to "remove" Style
and add new Style
Code: Select all | Expand
nStyle := nOr(nStyle,nView)
SetWindowLong(::hLv , GWL_STYLE , nStyle )
but i can´t find nAndNot() in c:\fwh\source\function\or.c
how to "remove" Style under FiveWin

Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 8:21 am
by nageswaragunupudi
Code: Select all | Expand
nStyle := GetWindowLong( ::hWnd, GWL_STYLE )
SetWindowLong( ::hWnd, GWL_STYLE, nAnd( nStyle, nNot( nRemveStyle ) ) )
Another way:
Code: Select all | Expand
nExistingStyle := GetWindowLong( ::hWnd, GWL_STYLE )
if lAnd( nExistingStyle, nRemoveStyle )
nNewStyle := nXor( nExistingStyle, nRemoveStyle )
SetWindowLong( hWnd, GWL_STYLE, nNewStyle )
endif
Please see
METHOD GetSetGWLStyle( lExtended, nStyle, lOnOff ) CLASS TWindow
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 8:47 am
by nageswaragunupudi
If you make a class as derived from TWindow class (or better TControl class)
We can use Parent method:
Code: Select all | Expand
oOurWnd:WinStyle( nNewStyle, lOnOff )
// .t. to add new style
// .f. to remove style, if already exists
This does everything that is needed.
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 9:05 am
by nageswaragunupudi
Am I write in my understanding the you are developing a new class TGRID using ListView. For it to work with FWH Windows and dialogs, we have to derive the class from TControl.
TControl is derived from TWinndow.
So the new TGrid class already has all methods of TControl and TWindow.
You need not spend your time in writing code from scratch like using GetWindowLong(...) and SetWindowLong(..). All such things are already available in a very simple and userfriendly way.
A user of TGrid class can
Code: Select all | Expand
oGrid := TGrid():New( oWnd, <other params,...> )
oGrid:WinStyle( nStyle, .t. to add or .f. to remove)
Re: bOr / nOr : how to "add" Constante under FiveWin
Posted: Tue Oct 18, 2022 10:15 am
by Jimmy
hi,
i´m still a Newbie under FiveWin and did not know that TControl have Method to change Style.
will it work with Listview as i have not found any Listview_Macro
i now use this HB_FUNC() for TGrid()
Code: Select all | Expand
HB_FUNC( LV_CHANGEEXTENDEDSTYLE )
{
#ifndef _WIN64
HWND hWnd = ( HWND ) hb_parnl( 1 );
#else
HWND hWnd = ( HWND ) hb_parnll( 1 );
#endif
DWORD Add = (DWORD) hb_parnl (2);
DWORD Remove = (DWORD) hb_parnl (3);
DWORD OldStyle, NewStyle, Style;
OldStyle = ListView_GetExtendedListViewStyle (hWnd);
NewStyle = (OldStyle | Add) & ( ~Remove );
Style = ListView_SetExtendedListViewStyle ( hWnd, NewStyle );
hb_retnl ((LONG) Style);
}