1. RE: w32engin

Tyler Southwick wrote:

> > 
> >   pCol = struc("LV_COLUMN")
> > 
> >   put(pCol, "mask", OR({LVCF_TEXT,LVCF_WIDTH}))
> >   put(pCol, "cx", 100)
> > 
> >   put(pCol, "pszText", "test")
> > 
> > 
> i changed the above:
> put(pCol, "pszText", "test")
> to:
> put(pCol, "pszText", sz("test"))
> but the text is displayed as a couple of lines.  how do i change it?
> -tyler

Tyler:

   I assume that you are setting the coulmn header.
   I don't think it is a problem with the w32engine.

   Be sure that you are allowing enough width, the
   width in cx is given in PIXELS. You could try using
   fmt and setting the text to left justify. It is
   hard for me to help you with out seeing a complete
   code listing. 

Bernie

new topic     » topic index » view message » categorize

2. RE: w32engin

> 
> Tyler:
> 
>    I assume that you are setting the coulmn header.
>    I don't think it is a problem with the w32engine.
> 
>    Be sure that you are allowing enough width, the
>    width in cx is given in PIXELS. You could try using
>    fmt and setting the text to left justify. It is
>    hard for me to help you with out seeing a complete
>    code listing. 
> 
> Bernie
> 

Here is a copy of my code (I don't have access to attachments):
<code>
without warning
include w32engin.ew
include dll.e

HWND hLV

--List View Support
global constant 
LVM_FIRST=4096,LVCF_FMT=1,LVCF_WIDTH=2,LVCF_TEXT=4,LVCF_SUBITEM=8,LVM_INSERTCOLUMN=(LVM_FIRST+97)


StList &= { {0,"LV_COLUMN",
    "mask        : uint   : 1 "& 
    "fmt         : int    : 1 "&
    "cx          : int    : 1 "&
    "pszText     : pointer : 1 "&
    "cchTextMax  : int    : 1 "&
    "iSubItem    : int    : 1 "} }

-- Define the Main CallBack Procedure to respond to messages from 
Windows.
function MainProc(HWND hWnd,UINT case,WPARAM wParam, LPARAM lParam)
pointer pCol
atom void
  if case = WM_CREATE then    
    hLV = CreateWindowExA({WS_EX_CLIENTEDGE, sz(WC_LISTVIEWA), NULL,
			OR({WS_VISIBLE,WS_CHILD,WS_BORDER, LVS_REPORT, 
LVS_SHOWSELALWAYS,LVS_SINGLESEL}),
			0, 0, 300, 500,
			hWnd, NULL, NULL, NULL })
    if hLV = NULL then void = MessageBoxA({hWnd, "Error Creating 
ListView!", "asdf", 0}) end if
    
    pCol = struc("LV_COLUMN")
    put(pCol, "mask", OR({LVCF_TEXT,LVCF_WIDTH}))
    put(pCol, "cx", 100)
    put(pCol, "pszText", sz("test"))

    void = SendMessageA({hLV, LVM_INSERTCOLUMN, 0, pCol})
  elsif case = WM_DESTROY then -- Received message to Shutdown.
    PostQuitMessage(0)      -- Tell windows to close the Application.
  else -- Default Built-in Window Procedure will Respond to any other 
messages
    return DefWindowProcA({hWnd,case,wParam,lParam})
  end if
  return 0 -- Euphoria needs to have a function return something.
end function

-- The Main Window.
procedure MainWindow()
RESULT ok
HWND hWnd
WNDCLASS wc
MSG msg
  -- Define the class
  -- Declare the window class structure & initialize the members
  wc = struc({"WNDCLASS",{OR({CS_HREDRAW,CS_VREDRAW}), -- Class and 
Styles
	      -- Tell Windows where to send callback messages for this Class
                    call_back(routine_id("MainProc")), -- Callback 
Procedure
                                                0,0,0, -- Not needed
                       LoadIconA({0,IDI_APPLICATION}), -- Default icon
                           LoadCursorA({0,IDC_ARROW}), -- Default Cursor
                                       COLOR_WINDOW+1, -- Background 
Color
                                           sz("Menu"), -- szpointer Menu 
name
                                  sz("SimpleClass")}}) -- szpointer 
Class name
  -- Register the class that was just defined.
  ok = RegisterClassA(wc)
  --init common controls
  InitCommonControls()
  -- Create an instance of the Registered Class
  hWnd = CreateWindowA({sz("SimpleClass"), -- szpointer Class name
             sz(" Generic Simple Window"), -- szPointer Window Title
                      WS_OVERLAPPEDWINDOW, -- Window style
                          200,100,400,300, -- X, Y, Width, Height
                      0,0,THIS_PROGRAM,0})
  -- Display the window
  ok = ShowWindow({hWnd,SW_SHOWNORMAL})
  -- Paint the client area by sending WM_PAINT to the Window
  ok = UpdateWindow(hWnd)
  -- Declare a message structure.
  msg = struc("MSG")
  -- Create the message loop.
  -- Retrieve a message from the Windows message queue
  --   and copys it to an MSG structure.
  while GetMessageA({msg,0,0,0}) do
    -- Translate any virtual-key messages
    --   to the real keys
    ok = TranslateMessage(msg)
    -- Dispatch the message to the handle
    --   specified in MSG structure
    ok = DispatchMessageA(msg)
  end while
--
end procedure

MainWindow()

</code>

I assume that you have w32eng

new topic     » goto parent     » topic index » view message » categorize

3. RE: w32engin

Tyler: 

  Your problem is that you are trying to use 

  LVM_INSERTCOLUMNW = (LVM_FIRST + 97)
  which would be used for UNICODE text.

  The string that you are creating sz("Test") is an ASII
  string so you shold use the ASCII value
  LVM_INSERTCOLUMNA = (LVM_FIRST + 27)

  In your constants change LVM_INSERTCOLUMN
  from:   INSERTCOLUMN = LVM_FIRST + 97
  to  :   INSERTCOLUMN = LVM_FIRST + 27

  and your code will work.

  When you create constants and functions be
  sure not to mix the A and W because this will
  cause alot of headaches.

  Most people use the ( A ) ASCII versions and
  not the ( W ) UNICODE versions of the constants and functions.

  If you are looking at an include file you will notice
  that it will assign the appropriate constant or function
  version by a conditional statement.

Bernie

new topic     » goto parent     » topic index » view message » categorize

4. RE: w32engin

Tyler Southwick wrote:
> I am trying to define the structure "LV_COLUMN" with w32engin, but can't 
> 
> use the c type "LPTSTR".  From the win32 docs the structure is defined:
> 
> typedef struct _LV_COLUMN { 
>     UINT mask; 
>     int fmt; 
>     int cx; 
>     LPTSTR pszText; 
>     int cchTextMax; 
>     int iSubItem; 
> } LV_COLUMN; 
> 
> I defined it as:
> StList &= { {0,"LV_COLUMN",
>     "mask        : UINT   : 4 "& 
>     "fmt         : int    : 4 "&
>     "cx          : int    : 4 "&
>     "pszText     : LPTSTR : 4 "&
>     "cchTextMax  : int    : 4 "&
>     "iSubItem    : int    : 4 "} }
> 
> but i get the message that LPTSTR is an invalid C type.  how do i make 
> it work?
> 
> 

StList &= { {0,"LV_COLUMN",
 "mask        : uint    : 1 "& 
 "fmt         : int     : 1 "&
 "cx          : int     : 1 "&
 "pszText     : pointer : 1 "&
 "cchTextMax  : int     : 1 "&
 "iSubItem    : int     : 1 "} }

  pszText is a pointer to a zero terminated string.

  The last numbers should be 1 for each member of the
  structure because it is the number of units or ints or pointers.
  If you were describing for example 20 bytes you
  would use something like "data : byte : 20"

Bernie

new topic     » goto parent     » topic index » view message » categorize

5. RE: w32engin

Bernie Ryan wrote:
> 
> Tyler Southwick wrote:
> > I am trying to define the structure "LV_COLUMN" with w32engin, but can't 
> > 
> > 
> > use the c type "LPTSTR".  From the win32 docs the structure is defined:
> > 
> > typedef struct _LV_COLUMN { 
> >     UINT mask; 
> >     int fmt; 
> >     int cx; 
> >     LPTSTR pszText; 
> >     int cchTextMax; 
> >     int iSubItem; 
> > } LV_COLUMN; 
> > 
> > I defined it as:
> > StList &= { {0,"LV_COLUMN",
> >     "mask        : UINT   : 4 "& 
> >     "fmt         : int    : 4 "&
> >     "cx          : int    : 4 "&
> >     "pszText     : LPTSTR : 4 "&
> >     "cchTextMax  : int    : 4 "&
> >     "iSubItem    : int    : 4 "} }
> > 
> > but i get the message that LPTSTR is an invalid C type.  how do i make 
> > it work?
> > 
> > 
> StList &= { {0,"LV_COLUMN",
>  "mask        : uint    : 1 "& 
>  "fmt         : int     : 1 "&
>  "cx          : int     : 1 "&
>  "pszText     : pointer : 1 "&
>  "cchTextMax  : int     : 1 "&
>  "iSubItem    : int     : 1 "} }
> 
>   pszText is a pointer to a zero terminated string.
> 
>   The last numbers should be 1 for each member of the
>   structure because it is the number of units or ints or pointers.
>   If you were describing for example 20 bytes you
>   would use something like "data : byte : 20"
> 
> Bernie

I still get an error when i try to put a value into pszText:

  pointer pCol

  pCol = struc("LV_COLUMN")

  put(pCol, "mask", OR({LVCF_TEXT,LVCF_WIDTH}))
  put(pCol, "cx", 100)

  put(pCol, "pszText", "test")

new topic     » goto parent     » topic index » view message » categorize

6. RE: w32engin

Tyler Southwick wrote:
> 
> Bernie Ryan wrote:
> > 
> > Tyler Southwick wrote:
> > > I am trying to define the structure "LV_COLUMN" with w32engin, but can't 
> > > 
> > > 
> > > use the c type "LPTSTR".  From the win32 docs the structure is defined:
> > > 
> > > typedef struct _LV_COLUMN { 
> > >     UINT mask; 
> > >     int fmt; 
> > >     int cx; 
> > >     LPTSTR pszText; 
> > >     int cchTextMax; 
> > >     int iSubItem; 
> > > } LV_COLUMN; 
> > > 
> > > I defined it as:
> > > StList &= { {0,"LV_COLUMN",
> > >     "mask        : UINT   : 4 "& 
> > >     "fmt         : int    : 4 "&
> > >     "cx          : int    : 4 "&
> > >     "pszText     : LPTSTR : 4 "&
> > >     "cchTextMax  : int    : 4 "&
> > >     "iSubItem    : int    : 4 "} }
> > > 
> > > but i get the message that LPTSTR is an invalid C type.  how do i make 
> > > it work?
> > > 
> > > 
> > StList &= { {0,"LV_COLUMN",
> >  "mask        : uint    : 1 "& 
> >  "fmt         : int     : 1 "&
> >  "cx          : int     : 1 "&
> >  "pszText     : pointer : 1 "&
> >  "cchTextMax  : int     : 1 "&
> >  "iSubItem    : int     : 1 "} }
> > 
> >   pszText is a pointer to a zero terminated string.
> > 
> >   The last numbers should be 1 for each member of the
> >   structure because it is the number of units or ints or pointers.
> >   If you were describing for example 20 bytes you
> >   would use something like "data : byte : 20"
> > 
> > Bernie
> 
> I still get an error when i try to put a value into pszText:
> 
>   pointer pCol
> 
>   pCol = struc("LV_COLUMN")
> 
>   put(pCol, "mask", OR({LVCF_TEXT,LVCF_WIDTH}))
>   put(pCol, "cx", 100)
> 
>   put(pCol, "pszText", "test")
> 
> 
i changed the above:
put(pCol, "pszText", "test")
to:
put(pCol, "pszText", sz("test"))
but the text is displayed as a couple of lines.  how do i change it?
-tyler

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu