1. Win32Lib: Disable Focusability

How would I make a ListView unfocusable? That is, I want the list
to display normally, but I want to prevent any selection. If I
"disable" the list, it displays with a gray background and light
characters and it cannot be scrolled. I know there must be a way
to make it display normally, but just not be able to have selections
made, yet still scroll it. :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Win32Lib: Disable Focusability

cklester wrote:
> 
> How would I make a ListView unfocusable? That is, I want the list
> to display normally, but I want to prevent any selection. If I
> "disable" the list, it displays with a gray background and light
> characters and it cannot be scrolled. I know there must be a way
> to make it display normally, but just not be able to have selections
> made, yet still scroll it. :)

What's the problem with making selections? You don't have to *do* anything
when a selection is made. 

Anyhow, there is no real easy way to do this.  You might have to catch
selection events then deselect the item manually.

Alternatively, you could use an owner-drawn listview, but that is **LOTS**
of work. 

Have you tried make a listview without a scroll bar, and do your own
scrollbar next to it. That way you could disable the listview, change
the background back to its normal color, and still manage the scrolling.
This would still be a lot of work.

So I don't really know if its worth the effort.

-- 
Derek Parnell
Melbourne, Australia

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

3. Re: Win32Lib: Disable Focusability

Derek Parnell wrote:
> cklester wrote:
> > How would I make a ListView unfocusable? That is, I want the list
> > to display normally, but I want to prevent any selection. If I
> > "disable" the list, it displays with a gray background and light
> > characters and it cannot be scrolled. I know there must be a way
> > to make it display normally, but just not be able to have selections
> > made, yet still scroll it. :)
> 
> What's the problem with making selections? You don't have to *do* anything
> when a selection is made. 

Well, I don't want my user thinking, "Okay, I've selected it. What can
I do with it?" Just a nice, plain, black text on white background list
that can be scrolled.

> Anyhow, there is no real easy way to do this.  You might have to catch
> selection events then deselect the item manually.

I smell a EuControl in the making! (Tommy?!) :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

4. Re: Win32Lib: Disable Focusability

cklester wrote:
> Well, I don't want my user thinking, "Okay, I've selected it. What can
> I do with it?" Just a nice, plain, black text on white background list
> that can be scrolled.
> 

CK,

There is another option...you can use Phil Russel's EuGrid to accomplish 
the task. It involves creating a Grid with static controls, disabling row
selection and disabling cell border highlighting.  It looks kinda like a 
list view and the user can't select a row.  Here's a small example that I
"whipped" up, hope it helps (note that I created the whole thing with the
IDE).

Jonas

--  code generated by Win32Lib IDE v0.18.17

 
include Win32Lib.ew
without warning
include euGrid.ew
atom gridvoid

--------------------------------------------------------------------------------
--  Window Main
constant Main = createEx( Window, "Simulated Read Only List View", 0, Default,
Default, 530, 436, 0, 0 )
integer TestGrid TestGrid = EGW_CreateGrid( Main, 24, 24, 480, 316, 1 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ACTIVE_HEADERS, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ALLOW_COL_SORT, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_CELL_BORDER, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_DATACOL,EGW_ROWNUM )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_SELECT,EGW_NONE )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_WIDTH,0 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_COL_HEADER_HEIGHT,20 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
integer Col1 Col1 = EGW_AddColumn( TestGrid, "Column 1", 100, EGW_LAST,
EGW_STATIC, 1 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col2 Col2 = EGW_AddColumn( TestGrid, "Column 2", 100, EGW_LAST,
EGW_STATIC, 2 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col3 Col3 = EGW_AddColumn( TestGrid, "Column 3", 100, EGW_LAST,
EGW_STATIC, 3 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_BACKGROUND_COLOR,
16777215)
constant OkayPB = createEx( DefPushButton, "Okay", Main, 28, 360, 88, 28, 0, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
procedure Main_onOpen (integer self, integer event, sequence params)--params is
()
	sequence grid_data
	atom void
	-- Put some data in the grid
	grid_data = {
		{"Row 1 Col 1","Row 1 Col 2","Row 1 Col 3"},
		{"Row 2 Col 1","Row 2 Col 2","Row 2 Col 3"},
		{"Row 3 Col 1","Row 3 Col 2","Row 3 Col 3"}}
	void = EGW_LoadData(TestGrid,grid_data,EGW_REPLACE)
end procedure
setHandler( Main, w32HOpen, routine_id("Main_onOpen"))
--------------------------------------------------------------------------------
procedure OkayPB_onClick (integer self, integer event, sequence params)--params
is ()
	closeWindow(Main)
end procedure
setHandler( OkayPB, w32HClick, routine_id("OkayPB_onClick"))


WinMain( Main,Normal )


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

5. Re: Win32Lib: Disable Focusability

cklester wrote:
> I smell a EuControl in the making! (Tommy?!) :)

I wouldn't mind making a new EuControl, but for the moment, I don't have any
more time to do it: I have a fulltime job (as programmer), and I'm working on the
following projects in Euphoria:
- EuControls, LayoutPanels and SpinBall/Disc: enhancing the existing EuControls
- IDE Plugin system (together with Judith): a plugin system for IDE (custom
controls and components: designed for EuControls, but more generalized)
- Kanarie: a template-system that can be used to generate text-files (HTML, XML,
...) from data (example: webserver running Euphoria)

I have an idea:
The only available EuControls for the moment, are created by me. That's logical,
since I created the EuControls-architecture and I know it best. But the library
is documented, and everybody should be able to create custom EuControls. My idea
is to have a contest for creating EuControls, where everybody (not including me)
can participate by creating one or more EuControls. All participants can ask me
anything about the EuControls-architecture. There could be different categories:
most original control, most useful control, ...
To ask me questions:
- mail: tommy,carlier#pandora,be
- irc: irc.sorcery.net:6667/euphoria
- EUforum: http://www.listfilter.com/EUforum
- UBoard: http://uboard.proboards32.com

--
tommy online: http://users.pandora.be/tommycarlier
Euphoria Message Board: http://uboard.proboards32.com

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

6. Re: Win32Lib: Disable Focusability

Jonas Temple wrote:
> 
> list view and the user can't select a row.  Here's a small example that I
> "whipped" up, hope it helps (note that I created the whole thing with the
> IDE).

Jonas, some of the code got cremated...

> <font
> color="#FF0055">--------------------------------------------------------------------------------</font>
> <font color="#FF0055">--  Window Main</font>
> <font color="#0000FF">constant </font><font color="#330033">Main = createEx(
> Window, </font><font color="#00A033">"Simulated Read Only List View"</font><font
> color="#330033">, 0, Default, Default,</font>

Like that one...

Could you repost that again?! :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

7. Re: Win32Lib: Disable Focusability

cklester wrote:
> 
> Jonas, some of the code got cremated...
> Could you repost that again?! :)
> 

Arrrggghhhh!

I just checked again and when I paste the code into the web interface
it has all the code so I guess it's chopping it off afterwards!

Try this one....

Jonas
--  code generated by Win32Lib IDE v0.18.17

 
include Win32Lib.ew
without warning
include euGrid.ew
atom gridvoid

--------------------------------------------------------------------------------
--  Window Main
constant Main = createEx( Window, "Simulated Read Only List View", 0, Default, 
Default, 530, 436, 0, 0 )
integer TestGrid TestGrid = EGW_CreateGrid( Main, 24, 24, 480, 316, 1 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ACTIVE_HEADERS, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ALLOW_COL_SORT, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_CELL_BORDER, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_DATACOL,EGW_ROWNUM )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_SELECT,EGW_NONE )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_WIDTH,0 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_COL_HEADER_HEIGHT,20 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
integer Col1 Col1 = EGW_AddColumn( TestGrid, "Column 1", 100, EGW_LAST,
EGW_STATIC, 1 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col2 Col2 = EGW_AddColumn( TestGrid, "Column 2", 100, EGW_LAST,
EGW_STATIC, 2 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col3 Col3 = EGW_AddColumn( TestGrid, "Column 3", 100, EGW_LAST,
EGW_STATIC, 3 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_BACKGROUND_COLOR,
16777215)
constant OkayPB = createEx( DefPushButton, "Okay", Main, 28, 360, 88, 28, 0, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
procedure Main_onOpen (integer self, integer event, sequence params)--params is
()
	sequence grid_data
	atom void
	-- Put some data in the grid
	grid_data = {
		{"Row 1 Col 1","Row 1 Col 2","Row 1 Col 3"},
		{"Row 2 Col 1","Row 2 Col 2","Row 2 Col 3"},
		{"Row 3 Col 1","Row 3 Col 2","Row 3 Col 3"}}
	void = EGW_LoadData(TestGrid,grid_data,EGW_REPLACE)
end procedure
setHandler( Main, w32HOpen, routine_id("Main_onOpen"))
--------------------------------------------------------------------------------
procedure OkayPB_onClick (integer self, integer event, sequence params)--params
is ()
	closeWindow(Main)
end procedure
setHandler( OkayPB, w32HClick, routine_id("OkayPB_onClick"))


WinMain( Main,Normal )


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

8. Re: Win32Lib: Disable Focusability

cklester wrote:
> 
> Jonas, some of the code got cremated...
> 
> Could you repost that again?! :)
> 
> -=ck
Double arrggghhhh!!!!!!

I just looked at the post on EuForm and there were a few more lines that
got truncated.  This one should do it :)

Rob, is there any way to fix this problem?

Jonas

--  code generated by Win32Lib IDE v0.18.17

 
include Win32Lib.ew
without warning
include euGrid.ew
atom gridvoid

--------------------------------------------------------------------------------
--  Window Main
constant Main = createEx( Window, "Simulated Read Only List View", 0, 
Default, Default, 530, 436, 0, 0 )
integer TestGrid TestGrid = EGW_CreateGrid( Main, 24, 24, 480, 316, 1 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ACTIVE_HEADERS, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ALLOW_COL_SORT, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_CELL_BORDER, False )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_DATACOL,EGW_ROWNUM )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_SELECT,EGW_NONE )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_ROW_HEADER_WIDTH,0 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_COL_HEADER_HEIGHT,20 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
gridvoid = EGW_SetGridProperty( TestGrid, EGW_BACKGROUND_COLOR,16777215 )
integer Col1 Col1 = EGW_AddColumn( TestGrid, "Column 1", 100, EGW_LAST, 
EGW_STATIC, 1 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col1, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col2 Col2 = EGW_AddColumn( TestGrid, "Column 2", 100, EGW_LAST, 
EGW_STATIC, 2 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col2, EGW_COL_BACKGROUND_COLOR,
16777215)
integer Col3 Col3 = EGW_AddColumn( TestGrid, "Column 3", 100, EGW_LAST, 
EGW_STATIC, 3 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_WIDTH, 148 )
gridvoid = EGW_SetColumnProperty( TestGrid, Col3, EGW_COL_BACKGROUND_COLOR,
16777215)
constant OkayPB = createEx( DefPushButton, "Okay", Main, 28, 360, 88, 28, 0, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
procedure Main_onOpen (integer self, integer event, sequence params)--params is
()
	sequence grid_data
	atom void
	-- Put some data in the grid
	grid_data = {
		{"Row 1 Col 1","Row 1 Col 2","Row 1 Col 3"},
		{"Row 2 Col 1","Row 2 Col 2","Row 2 Col 3"},
		{"Row 3 Col 1","Row 3 Col 2","Row 3 Col 3"}}
	void = EGW_LoadData(TestGrid,grid_data,EGW_REPLACE)
end procedure
setHandler( Main, w32HOpen, routine_id("Main_onOpen"))
--------------------------------------------------------------------------------
procedure OkayPB_onClick (integer self, integer event, sequence params)--params
is ()
	closeWindow(Main)
end procedure
setHandler( OkayPB, w32HClick, routine_id("OkayPB_onClick"))


WinMain( Main,Normal )


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

9. Re: Win32Lib: Disable Focusability

> > > How would I make a ListView unfocusable? That is, I want the list
> > > to display normally, but I want to prevent any selection. If I
> > > "disable" the list, it displays with a gray background and light
> > > characters and it cannot be scrolled. I know there must be a way
> > > to make it display normally, but just not be able to have selections
> > > made, yet still scroll it. :)
> > 
> > What's the problem with making selections? You don't have to *do* anything
> > when a selection is made. 
> 
> Well, I don't want my user thinking, "Okay, I've selected it. What can
> I do with it?" Just a nice, plain, black text on white background list
> that can be scrolled.
> 
> > Anyhow, there is no real easy way to do this.  You might have to catch
> > selection events then deselect the item manually.
> 
> I smell a EuControl in the making! (Tommy?!) :)

I dont know if a custom control for this is the way to go.  I can (offhand)
think of two or three different ways to do this.

1> subclass the control and intercept all mouse events unless
   its over the scroll bar.

2> create a "see through" window the same size as the client area
   of the ListView.  

actually I can think of more, but these would be the easiest =)
I will play around with some of these ideas tonight and if I get
anything working ill let you know...


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

10. Re: Win32Lib: Disable Focusability

Don wrote:
> 
> 1> subclass the control and intercept all mouse events unless
>    its over the scroll bar.

Can you explain what it means to subclass a control? Thanks!!! :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

11. Re: Win32Lib: Disable Focusability

Jonas Temple wrote:
> 
> cklester wrote:
> > 
> > Jonas, some of the code got cremated...
> > 
> > Could you repost that again?! :)
> > 
> > -=ck
> Double arrggghhhh!!!!!!
> 
> I just looked at the post on EuForm and there were a few more lines that
> got truncated.  This one should do it :)
> 
> Rob, is there any way to fix this problem?

It should work better now.
I might adjust it some more later.
It was truncating long lines of syntax-colored code.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

12. Re: Win32Lib: Disable Focusability

> > 1> subclass the control and intercept all mouse events unless
> >    its over the scroll bar.
> 
> Can you explain what it means to subclass a control? Thanks!!! :)

Sure thing.

Lets say you create a plain window and have a message loop for it.
In most cases (with Win32Lib) it has a message loop and it doles out
messages to your routines depending on which ones you need.

Subclassing involves taking over of the normal message loop and replacing
it with one of your own.  I could (in effect) have Windows send my routine
*all* messages meant for the window before Win32Lib (or anything else)
can see it and do my own processing first.  In the case of the ListView,
we could subclass the control and handle all mouse events ourselves.  Any
message we dont process I can pass to its normal handler (Win32Lib).  Its
simply a way to customize a controls behaviour with our own routine.


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

13. Re: Win32Lib: Disable Focusability

Don wrote:
> 
> > > 1> subclass the control and intercept all mouse events unless
> > >    its over the scroll bar.
> > 
> > Can you explain what it means to subclass a control? Thanks!!! :)
> 
> Sure thing.
> 
> Lets say you create a plain window and have a message loop for it.
> In most cases (with Win32Lib) it has a message loop and it doles out
> messages to your routines depending on which ones you need.
> 
> Subclassing involves taking over of the normal message loop and replacing
> it with one of your own.  I could (in effect) have Windows send my routine
> *all* messages meant for the window before Win32Lib (or anything else)
> can see it and do my own processing first.  In the case of the ListView,
> we could subclass the control and handle all mouse events ourselves.  Any
> message we dont process I can pass to its normal handler (Win32Lib).  Its
> simply a way to customize a controls behaviour with our own routine.


D'oh!! I forgot about the 'subclassing' trick. 

In Win32lib, all you need to do to avoid selecting items in a listview
is this ...

 procedure Event_lv(integer self, integer event, sequence parms)
   if find(parms[1],{WM_LBUTTONDOWN, WM_RBUTTONDOWN}) then
      returnValue(-1)
   end if
 end procedure
 setHandler(lv, w32HEvent, routine_id("Event_lv"))


-- 
Derek Parnell
Melbourne, Australia

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

14. Re: Win32Lib: Disable Focusability

> D'oh!! I forgot about the 'subclassing' trick. 
> 
> In Win32lib, all you need to do to avoid selecting items in a listview
> is this ...
> 
>  procedure Event_lv(integer self, integer event, sequence parms)
>    if find(parms[1],{WM_LBUTTONDOWN, WM_RBUTTONDOWN}) then
>       returnValue(-1)
>    end if
>  end procedure
>  setHandler(lv, w32HEvent, routine_id("Event_lv"))

Cool =) thanks Derek...
Saves me the trouble of firing up the old text editor hehe


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu