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 

Greying out possible %`ls selections?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



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

PostPosted: Wed Jun 19, 2019 11:41 am    Post subject: Greying out possible %`ls selections? Reply with quote

I have a conundrum that I would like some help with, please. Or just some opinion.

The particular dataset requires a number of points to be identified by capital letters. For something like 50 years, there has been no need to get a sequence longer than A..F, or very occasionally, A..G (i.e. 6 or 7 points) There still isn't. And that resolves the issue of I and O being deprecated for such purposes.

After the coordinates have been defined, the length of the list is 6 or 7 - if the letters are alphabetically consecutive. It appears that the current user, for reasons of his own*, likes A-B-C and X-Y-Z. Still 6, but with a big gap in the alphabetical sequence. This is accommodated by the present program, as I had the forethought to allow the whole alphabet (i.e. to make the program capacity 26, not fewer. I think that decision is the source of the trouble!

Anyway, in the course of being used, individual points are selected from a drop-down list %`ls. What I'd like to be able to do is to keep the full sequence of letters in the list, but make some of them not selectable (greyed out). Is that a Windows standard thing to do? Is it possible in Clearwin+?

If I can't, then I know that I can 'beep' inadmissable selections in the control's callback, which is probably what I'll have to do. The final option looks like more work, and that is to sort out the inadmissable letters before entering the routine with the %`ls control, and then to decypher the return value.

Has anyone come across something like this before?

*Obstinacy, insubordination - refusal to obey instructions - characteristic of the county** he hails from, and in a different context, perhaps even admirable!

**The one that contains Ilkley Moor ...
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Thu Jun 20, 2019 2:51 am    Post subject: Reply with quote

You could do this from a menu, but not the %ls itself.

One "feature" of the %ls is you can tell it that you have 26 entries, but only have as non-blank the entries you wish to have displayed (6 in your example). The underlying code can set the list to be what it needs to be without the winio@() having to change at all.

Would this work for you?

Also, using %ud to pass in to the call back the address of the list itself gives you complete control to extract the contents of the list item based on the selection being made. If this interests you, I can provide a code example. I use this all the time (now that %ud is implemented).

Bill
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: Thu Jun 20, 2019 10:36 am    Post subject: Reply with quote

Quote:
One "feature" of the %ls is you can tell it that you have 26 entries, but only have as non-blank the entries you wish to have displayed (6 in your example). The underlying code can set the list to be what it needs to be without the winio@() having to change at all.


That's what I'm after, but on reading the CHM file (yet again) I suspect that setting num_items to 6 just gives me the first 6.

I know how I ought to do it, but I was looking for a quick fix, as I can't do this and several other things for next Monday, well, not reliably, and if it isn't done by then I have a whole year in which to do it and the other things with confidence everything will work.

I hadn't thought of %ud, but I'll give it a look. Thanks.

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



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

PostPosted: Thu Jun 20, 2019 3:11 pm    Post subject: Reply with quote

Eddie, you are right that specifying "6" for num_items will give you the first 6; the actual number of items in the character array can be much bigger.

Using %ud to pass what is, in essence, a pointer to the array works great. You may have seen some of the other threads about a problem I encountered using the ALLOCATE() statement. From one of Paul's statements in an early post, I think he may have found what was causing the problem. In any event, it is relatively simple to use the pointer along with clearwin_info@('THIS') to get the item selected.

I have also used the %ud with user-defined TYPE (as a pointer) that contains (1) the pointer to the list AND (2) a pointer to the variable I'd like to set to a value, depending on the selection that was just made.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Fri Jun 21, 2019 7:09 am    Post subject: Reply with quote

There is no simple, way that I know of, to grey out individual items in a list box.

The least difficult approach may be to refresh the list so that it contains only selectable items. The ClearWin+ documentation indicates that blank items (containing only spaces) at the end of the list are not displayed. In others words, the number of programmed items can be larger than the number of items displayed. I have not tested this but you could give it a try.
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 21, 2019 9:33 am    Post subject: Reply with quote

Hi Paul,

I didn't expect that there was, but I thought I'd ask. Thanks.

As I replied to Bill's helpful comments, I do know what I have to do, but I can't reliably do it for next week, and the following use of the program is the same time next year, which gives me ample time to do it properly. I was looking for a quick fix. TANSTAAFL.

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
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