bOr / nOr : how to "add" Constante under FiveWin

bOr / nOr : how to "add" Constante under FiveWin

Postby Jimmy » Mon Oct 17, 2022 5:53 am

hi,

to set different Constante under Xbase++ i use

Code: Select all  Expand view
 ::oLVCol:mask := nOr( LVCF_FMT,  LVCF_WIDTH , LVCF_TEXT , LVCF_SUBITEM )


i know i can "add" Constante this Way

Code: Select all  Expand view
 ::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 ?
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby Antonio Linares » Mon Oct 17, 2022 6:44 am

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
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: bOr / nOr : how to "add" Constante under FiveWin

Postby nageswaragunupudi » Mon Oct 17, 2022 11:00 am

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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby Jimmy » Tue Oct 18, 2022 1:27 am

hi,

i wonder ...
Code: Select all  Expand view
#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"))
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby Jimmy » Tue Oct 18, 2022 8:07 am

hi,

i want to "remove" Style
Code: Select all  Expand view
  nStyle := nAndNot(::nStyle,LVS_ICON     )

and add new Style
Code: Select all  Expand view
  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 :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby nageswaragunupudi » Tue Oct 18, 2022 8:21 am

Code: Select all  Expand view
nStyle := nAnd( ::nStyle, nNot( LVS_ICON ) )


Code: Select all  Expand view
nStyle := GetWindowLong( ::hWnd, GWL_STYLE )
SetWindowLong( ::hWnd, GWL_STYLE, nAnd( nStyle, nNot( nRemveStyle ) ) )
 


Another way:
Code: Select all  Expand view

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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby nageswaragunupudi » Tue Oct 18, 2022 8:47 am

If you make a class as derived from TWindow class (or better TControl class)

We can use Parent method:

Code: Select all  Expand view

oOurWnd:WinStyle( nNewStyle, lOnOff )
// .t. to add new style
// .f. to remove style, if already exists
 

This does everything that is needed.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby nageswaragunupudi » Tue Oct 18, 2022 9:05 am

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.
Code: Select all  Expand view
CLASS TGrid 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 view

oGrid  := TGrid():New( oWnd, <other params,...> )
oGrid:WinStyle( nStyle, .t. to add or .f. to remove)
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bOr / nOr : how to "add" Constante under FiveWin

Postby Jimmy » Tue Oct 18, 2022 10:15 am

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 view
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);
}
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 99 guests