soccer jersey forums.silverfrost.com :: View topic - Suggestions for a complex Windows function?
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 

Suggestions for a complex Windows function?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 19, 2011 2:35 am    Post subject: Suggestions for a complex Windows function? Reply with quote

I'm trying to get Windows to do something complex... at least, it's complex for me.

I have a database that has many columns, like thirty of them. Each column has a title, such as Cost, Date Created, Date Modified, etc. My program reads in the entire database, all thirty columns. It will let the user print out a smaller database, with a subset of those columns. The user might choose to print out only five or ten columns or so.

I'm trying to create a way where the user is presented with a list of all thirty column titles, and he can pick which titles he wants to print out. The program will open two large boxes side by side (they might be listboxes or edit boxes or etc.). The left box contains a list of all the available titles, and the right box is empty (at first).

In between the two large boxes, are two buttons. One button shows a right arrow (or the word ADD), the other button shows a left arrow (or the word DELETE).

The user will click on one of the titles shown in the left box, then click on the Right-arrow button, and the title he highlighted vanishes from the left box and appears in the right box. He selects another title in the left box, and clicks the same Right-arrow button, and that title moves to the right box. He keeps doing this until all the titles of the columns he wants to print, are in the right box.

How would you do this?

One way is that each box might be an Editbox, each displaying a different string. The left box's string has all the titles, separated by linefeeds. The right box's string is empty at first. When the user clicks on a title in the left box, that title (but not the titles above or below it) get highlighted (can that be done?).

Then comes the tricky part (or, at least, the part I don't understand). How does the program know which title is highlighted? The title is just part of a long string. Is there a way the highlighted part, can be returned as a shorter string somehow? Or maybe the location of the first character in the highlighted part in the string, can be returned?

I think I know the rest. When the user highlights the title he wants and clicks the Right-arrow button, the program takes the characters to the left of the highlighted part, and the characters to the right of it, and concatenates them into a new string without the highlighted part in the middle. It overwrites the old string with the new string, and updates the window with that string in it, and the user sees the highlighted part apparently vanish. The program also inserts the characters that had been highlighted, into the other large box's string (the box on the right), and updates that window too, and the user sees the highlighted part appear in the box on the right.

So my question is, if an edit box contains a string that has many "words" separated by linefeeds, can the user highlight just one of those words? And, if he does, is there a way the progam knows which part got highlighted?

I'll try to attach a picture of what I mean, stolen^H^H^H^H^H^Hborrowed from another program:



The box on the left contains many titles (and a scrollbar, I know how to do that). The user has already transferred two of them to the box on the right, by highlighting a title and clicking the Right-arrow button, once for each title. He just finished highlighting "Description" and clicking the Right-arrow button, and now "Description" has been transferred to the box on the right.

I know how to do the transferring. But if the user highlights one of the titles on the left, how does the program know what he highlighted?
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Thu May 19, 2011 8:28 am    Post subject: Reply with quote

Hi Little-Acorn, may be this can help you?

Code:
integer*4     j,select
character*20  mtext(4)

mtext(1) = 'item_1'
mtext(2) = 'item_2'
mtext(3) = 'item_3'
mtext(4) = 'item_4'
select   = 1
j = winio@('%20.4ls',mtext,4L,select)

Write your items into separate text strings (mtext) and use %ls. When starting, set select to 1 (now the first row is highlighted). Now say that the user selects the third row, then the parameter select will have the value 3.

Regards - Wilfried
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Thu May 19, 2011 3:03 pm    Post subject: Re: Reply with quote

Wilfried Linder wrote:
Hi Little-Acorn, may be this can help you?

Code:
integer*4     j,select
character*20  mtext(4)

mtext(1) = 'item_1'
mtext(2) = 'item_2'
mtext(3) = 'item_3'
mtext(4) = 'item_4'
select   = 1
j = winio@('%20.4ls',mtext,4L,select)

Write your items into separate text strings (mtext) and use %ls. When starting, set select to 1 (now the first row is highlighted). Now say that the user selects the third row, then the parameter select will have the value 3.

Regards - Wilfried

Aww, that's way too simple. And here I thought it would be vastly complicated.

That will certainly work! Thank you, Wilfried! Very Happy

(wondering why I didn't think of that)
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 -> General All times are GMT + 1 Hour
Page 1 of 1

 
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