WC_LISTVIEW / "SysListView32" -> Unicode ?

WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Jimmy » Sun Jan 15, 2023 6:26 am

hi,

i use
Code: Select all  Expand view
#define CTRL_CLASS            "SysListView32"

and
Code: Select all  Expand view
CLASS TGrid FROM TControl

   ::Create( CTRL_CLASS )

but i have Problem when use FW_SetUnicode( .T. )

now i saw this in c:\BCC7\include\windows\commctrl.h
Code: Select all  Expand view
#define WC_LISTVIEWA            "SysListView32"
#define WC_LISTVIEWW            L"SysListView32"

#ifdef UNICODE
#define WC_LISTVIEW             WC_LISTVIEWW
#else
#define WC_LISTVIEW             WC_LISTVIEWA
#endif

#else
#define WC_LISTVIEW             "SysListView"
#endif

but this is for HB_FUNC()

Question : how can i use it for PRG Level :?:

i have try

Code: Select all  Expand view
#define CTRL_CLASS            "SysListView32W"

but that is wrong to create Control
Code: Select all  Expand view
#define CTRL_CLASS            L"SysListView32"

Error E0030 Syntax error "syntax error at 'SysListView32'"


so how can i use Unicode Version :?:
or must i use HB_FUNC() to create Unicode Control :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Antonio Linares » Sun Jan 15, 2023 7:42 am

Jimmy,

Try with AnsiToWide( "SysListView32" )
regards, saludos

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

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Jimmy » Sun Jan 15, 2023 8:29 am

hi Antonio,
try with AnsiToWide( "SysListView32" )

i have try it, in CH and PRG. and got
Error description: Error FiveWin/6 Cannot create window or control:
Class: TGRID
Caption:
System Error: Fensterklasse wurde nicht gefunden.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Jimmy » Sun Jan 15, 2023 8:35 pm

hi,

i have try to create a HB_FUNC() to create Control for TGrid()

Code: Select all  Expand view
  IF !EMPTY( oWnd:hWnd )
*     ::Create( CTRL_CLASS )  // AnsiToWide()
      ::hWnd := InitListView ( oWnd:hWnd, 0, nLeft,nTop, nWidth, nHeight , lDispInfo, 100, .T., .F., .T., .T. )
      oWnd:AddControl( Self )
   ELSE
      oWnd:DefControl( Self )
   ENDIF


it seems to work so far ... but while it is not ::Create( CTRL_CLASS ) it does not "react"

Question : is there a Way to assign Handle (::hWnd) of Control to CLASS TControl() :?:

Code: Select all  Expand view
HB_FUNC( INITLISTVIEW )
{
   HWND hwnd;
   HWND hbutton;
   int  style;

   INITCOMMONCONTROLSEX i;

   i.dwSize = sizeof( INITCOMMONCONTROLSEX );
   i.dwICC  = ICC_LISTVIEW_CLASSES;
   InitCommonControlsEx( &i );

   hwnd = ( HWND ) hb_parnll( 1 );

   style = LVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | LVS_REPORT;

   if( ! hb_parl( 9 ) )
      style = style | LVS_SINGLESEL;

   if( ! hb_parl( 12 ) )
      style = style | WS_TABSTOP;

   if( ! hb_parl( 10 ) )
      style = style | LVS_NOCOLUMNHEADER;
   else if( hb_parl( 11 ) )
      style = style | LVS_NOSORTHEADER;

   if( hb_parl( 7 ) )
      style = style | LVS_OWNERDATA;

   hbutton = CreateWindowEx
             (
      WS_EX_CLIENTEDGE,
      WC_LISTVIEW,
      TEXT( "" ),
      style,
      hb_parni( 3 ),
      hb_parni( 4 ),
      hb_parni( 5 ),
      hb_parni( 6 ),
      hwnd,
      ( HMENU ) hb_parnll( 2 ),
      GetModuleHandle(NULL),
      NULL
             );

   if( hb_parl( 7 ) )
      ListView_SetItemCount( hbutton, hb_parni( 8 ) );

   hb_retnl( ( LONG_PTR ) hbutton );
}
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Jimmy » Mon Jan 16, 2023 7:18 am

hi,

have found out that there is no Method Create in CLASS TControl()
so i have look into SUPER CLASS TWindow() and found

Code: Select all  Expand view
METHOD Create( cClsName )  CLASS TWindow
   ...
   if ::hWnd == 0
      WndCreateError( Self )
   else
      ::Link()
   endif
return nil
 

Method Link() is missing when not call ::CREATE() so i add it and now it seems to work

Question : when TGrid:End() will it "UnLink()" automatic when oTGrid:End() or do i have to do it manual :?:

...

i have try this Way while i had Problem with FW_SetUnicode( .T. ) to get Notify Event LVN_GETDISPINFO
but also using HB_FUNC() on this the Way Result is same : No LVN_GETDISPINFO

btw "where" is FW_SetUnicode() :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Antonio Linares » Mon Jan 16, 2023 7:19 am

Dear Jimmy,

> is there a Way to assign Handle (::hWnd) of Control to CLASS TControl()

do you mean a shared DATA to all controls ? handles must be owned by controls not by the class

Could you explain it with more detail ?
regards, saludos

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

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Jimmy » Mon Jan 16, 2023 9:32 am

hi Antonio,
do you mean a shared DATA to all controls ? handles must be owned by controls not by the class
Could you explain it with more detail ?

my HB_FUNC() does return Handle of new Create Control
Code: Select all  Expand view
*     ::Create( CTRL_CLASS )  // AnsiToWide()
      ::hWnd := InitListView ( oWnd:hWnd, 0, nLeft,nTop, nWidth, nHeight , lDispInfo, 100, .T., .F., .T., .T. )

Control is shown but does not "react" so i was not sure if it will work that Way

after found Method Link() now Control seems to work
but i´m not sure if i need "more" when Control was create this way
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WC_LISTVIEW / "SysListView32" -> Unicode ?

Postby Antonio Linares » Mon Jan 16, 2023 9:51 am

Dear Jimmy,

> after found Method Link() now Control seems to work

very good! :-)

> but i´m not sure if i need "more" when Control was create this way

Nothing else needed
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 100 guests