forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using %vx with %lv - Can it be done?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Jun 26, 2015 12:39 pm    Post subject: Using %vx with %lv - Can it be done? Reply with quote

I'm looking for a way to use the list view, but have control of the vertical scrollbar. As the user enters data (or edits data), I'm trying to re-position the view to the data just entered.

Some testing confirms that wherever the %lv scroll bar is, the view will stay there even when data are added/deleted. This is good, but not quite what I'm looking to do.

If I place a %vx ahead of the %lv, it attachs a scroll bar, but this bar has no effect - the %lv control has its own scrollbar.

Is there a way to access the "internal" scrollbars in the list view control, similar to %vx?
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jun 26, 2015 1:29 pm    Post subject: Reply with quote

You may be able to do something along the following lines...

1) Use %lc to get the HWND (call it hwnd say) for the %lv control (put %lc immediately after %lv)

2) Send messages to the %lv control using calls to SendMessage(hwnd, ....)

3) Try sending LVM_ENSUREVISIBLE first of all to see if that helps. See the Miscrosoft MSDN website for details.

4) Try sendiing LVM_SCROLL. Again, you will need to look at MSDN to work out values for all the arguments of SendMessage.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Jun 26, 2015 2:06 pm    Post subject: Reply with quote

Thanks, Paul! I'll see what I can do.

If I am successful, I'll post it here.
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jun 26, 2015 2:19 pm    Post subject: Reply with quote

Bill,

You'd be better advised to simply give up on %lv. It doesn't work, and hasn't worked for years, if ever. It may work with a simple demonstrator, but it just doesn't work for complicated cases.

If you search the forum (hint: search with 'listview' and not '%lv') you will find various alternatives. A good one is on page 3 of '%lv edit_cells'.

Eddie
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Jun 26, 2015 3:03 pm    Post subject: Reply with quote

Thanks, Eddie, for the heads-up. I did read that particular post.

While I'm still in development using the control, however, I am aware of the issues with various functions. I used, years ago, the TABLE control from XVT Software ("C"/"C++"), and this is as close as I can find without re-inventing the wheel.

In my case, I don't need to edit the cells. The presentation format is simply a display/select tool for me. The only functionality I intend to use is selection of a row to perform an action, then re-display of the data. Editing of the data directly in a cell is not practical for my application anyway.

Really simple, actually. %lv may be just what I need. If it is not, I'll surely post a reply here about why.

Bill
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jun 26, 2015 4:46 pm    Post subject: Reply with quote

If anyone has the time to create a short sample program for %lv, demonstrating how it fails, then I will add this to the list of things to do.

Please note that %lv was never intended to have spread sheet functionality.
It was merely an interface to the Microsoft ListView control as it was at the time of writing the code for %lv.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jun 26, 2015 5:14 pm    Post subject: Reply with quote

Paul,

I refer you to past forum discussion on this point. The problem is that when you construct a simple example, it works as though spreadsheet functionality was present, but then when you extend it, you run into problems - it stops acting on keypresses.

I'll take it as granted that %lv wasn't intended to be a mini-Excel, but, it looks like it should be, and the documentation indicates that it might be. On the other hand, I'm pretty sure that Excel doesn't employ an enormous listview ...

So many users of Fortran get to the point when they get tired of entering data into an editor and saving it as an input file for a program. I've used spreadsheets before to do that. It's not the Windows way. But, an editable array of values is a very natural way of inputting and correcting data, and many programmers of Fortran will see that as a way forward for their programs, and discovering %lv they believe they have found a spreadsheet control. (I did).

If my warning was a little harsh, then I apologise, but my personal experience was that if ever there was a timewaster, %lv was it (followed by some early experiences with %tv and %bv) and I recommend avoiding those controls if at all possible, and if not, then to be prepared to devote a lot of time to dealing with the issues that arise.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jun 26, 2015 9:34 pm    Post subject: Reply with quote

Thanks for the feedback Eddie.

Do you have a shortish program that illustrates the failure?
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Jun 27, 2015 1:32 pm    Post subject: Reply with quote

Paul,

I'll have a go.

Reading between the lines I am taking the hint that you believe that you've fixed all the previous issues, and I am commenting on how it used to be, not how it is!

I've been bitten by this in the past with popup menus in a %gr region that didn't work, and while I wasn't paying attention, you fixed them. Perhaps %lv is in the same category ...

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Jun 27, 2015 7:06 pm    Post subject: Reply with quote

Eddie,

I don't recall what the current state of %lv is.

As always, we depend on having sample code and being able to reproduce reported errors.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Jun 28, 2015 12:51 pm    Post subject: Reply with quote

Paul,

I have put a program that I used to develop ideas in connection with %lv into Dropbox here:

https://dl.dropboxusercontent.com/u/76596632/tt.for

Note that it is by no means complete or polished. It’s just at the state where I abandoned the approach.

The point is to create a list of stations lettered A … Z (excluding I and O) with x, y and h coordinates. Certainly, it is possible to move anywhere and edit the value, but the code does not allow for inserting out of sequence or deleting rows as I gave up before I got to that point. ICON1 in the resources can be any small icon – or none.

The ‘Add stations’ button puts an extra station on to the end of the list. One point noted by the original poster is that once the list is too long for the space defined, the scroll bars show up automatically. But, because the vertical scrollbar takes up space in the RH column, a horizontal scrollbar appears too. I didn’t like the way my headings line got messed with at this point.

I got %lv to respond to vertical and horizontal cursor keys or to allow section of a box with the mouse, but a leftward cursor key movement has what I think is unconventional behaviour if pressed beyond the point where ‘Easting’ is highlighted, ditto for the right cursor key in the ‘Ortho height’ column.

My replacement for the functionality I was trying to develop was to put the ‘spreadsheet’ into a %gr box, and to handle all the row/column/box selection in the %gr callback, and for the time being I do the editing of Easting, Northing and Ortho height (x, y and h) in three separate off-grid positions, rather like early windows spreadsheets (including Excel and Quattro Pro) did before they had in-grid editing.

Please don't waste much time looking at it, but I hasten to assure you that I spent a lot of effort on this before I decided that I could do it better in a %gr box and this is my evidence that I didn't just give up easily.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Jun 28, 2015 3:49 pm    Post subject: Reply with quote

Eddie

Correct me if I am wrong, but I think that you are saying that %lv was not useful to you because of missing functionality. Things like "delete a given line" or "insert a new line" could probably be added without too much difficulty.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Jun 28, 2015 6:06 pm    Post subject: Reply with quote

Hi Paul,

No, I was sure that I could add that functionality. I gave up before I got there. I give up when I find something I don't have control over, not simply through idleness!

The problem was unexpected effects, like a line through my titles (top row)as I added lines and the scroll bars appeared, and I didn't like the response to keys as I edited the box contents as it was different to the behaviour in %rf %rd boxes etc.

I can't remember precisely, but after a while editing the thing would not respond properly to cursor keys and I've always found fixing intermittent errors to be particularly taxing.

Eddie

PS. By 'code' I meant the source code I posted, not %lv.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Jul 08, 2015 8:20 am    Post subject: Reply with quote

It seems to me that what is missing is maybe a multi-column %pb rather than a mod of %lv.
That would allow input of varying type parameters in different cells hence removing the need for 'extraction' from text strings as in Eddie's code (see link above).

Now, having a bit of a shufty at the various related Windows API's which %lv etc.. are probably based, :-

I think Eddie might be half-right/half-wrong about E£xc el not being based on Listview. It's gotta be based on 'edit_control' for individual cells I'd imagine, with indesxes for content type, is there a formula, formatting, etc...... Not exactly listview based but same origins. Imight be wrong of course.

To get any kind of spreadsheet type functionality would probably require building from ground up based around the 'edit_control' API (from which I imagine 'list_view' API is derived (and hence %lv) ).
It's usefulness though would imo be very limited as the whole point of having a Fortran program imo is to avoid (improve on) using spreadsheets and all the anarchy that that creates in an engineering environment !

I'm not sure how whole lines would be highlighted/deleted but there appears to be stacks of functionality in the edit_control' an 'list_view' API's.

As I say, an extended %N.M.pb might be the better solution to the problem raised in the post and Eddies observations ?


PS - appears to me that the 'line through the column header' Eddie, which i saw when I added more lines than the space in the control window, corresponds to the outline of the first row of cells hidden by the header bar after scrolling. I have MS Windows transparency switched on (Win7)for my windows by default, not sure if its because of that and if it might disappear if that was reset.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Jul 08, 2015 10:20 am    Post subject: Reply with quote

Re:
Quote:
to avoid (improve on) using spreadsheets


Sometimes, the most natural way to input coordinates is simply to type them in to rows and columns. In the program for which the code fragment was developed, the process starts from a series of points, not less than 3 and rising to maybe 10 or 12, with positions determined to the UK national grid by a GPS device accurate to maybe 10mm. The device saves this data on a PCMCIA card (no longer supported by the University laptop computers) which contains a compact flash card (would need an adaptor to read) in CSV format, but the primary user who is a Yorkshireman says bluntly that he can't be bothered with all that when he can write them down in a notebook instead of going through a load of menus on the device!

So the problem isn't just the program, it is embedded in user preferences too.

I don't want to be drawn into a discussion as to whether graphical input is appropriate or not, but these points are measured to a precision of 10mm in a coordinate system where the maximum value is perhaps a million metres ...

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group