Return of selected element in listcontrol 
Author Message
 Return of selected element in listcontrol

Having a listcontrol where the FROM is set like:
  Listfrom = 'Car|Plane|Boat'
  ?List:Control{PROP:FROM} = ListFrom

Using the  CHOICE(?List:Control)  
I'll get the selected elementnumber.

But is there any runtime property which
will return the value of the selected
element? Since I'm not using a QUEUE
I need to parse the string.

Would like the choose to handle this like:
  CHOOSE(CHOICE(?List:Control),'Car|Plane|Boat')



Sun, 14 Apr 2002 03:00:00 GMT  
 Return of selected element in listcontrol
Hi

I am sure someone knows a better way, {*filter*}anyway

If you would use a simple function where:

! Definition:
PickChoice(USHORT,CSTRING),CSTRING

! in the code:
  Listfrom = 'Car|Plane|Boat'
  ?List:Control{PROP:FROM} = ListFrom
. . .
  PickChoice(CHOICE(?List:Control),ListFrom)

! the function:
PickChoice(ChoiceNr,ListFrom)
RetStr  CSTRING
_Start  BYTE
  CODE
  _Start  = 1
  LOOP ChoiceNr-1 TIMES
    _Start = INSTRING('|',ListFrom,1,_Start) + 1
    IF ~_Start OR _Start > LEN(ListFrom)
      RetStr = ''
      RETURN(RetStr)
      BREAK
    .
  .
  RetStr = SUB(ListFrom,_Start,INSTRING('|',ListFrom,1,_Start) - 1)
  RETURN(RetStr)

I haven't tested, so probably doesn't work properly, but my idea is here

Bjorn Kaustell

"Kristian Hyllestad

Quote:
> Having a listcontrol where the FROM is set like:
>   Listfrom = 'Car|Plane|Boat'
>   ?List:Control{PROP:FROM} = ListFrom

> Using the  CHOICE(?List:Control)
> I'll get the selected elementnumber.

> But is there any runtime property which
> will return the value of the selected
> element? Since I'm not using a QUEUE
> I need to parse the string.

> Would like the choose to handle this like:
>   CHOOSE(CHOICE(?List:Control),'Car|Plane|Boat')



Sun, 14 Apr 2002 03:00:00 GMT  
 Return of selected element in listcontrol

Quote:
> WHAT(ListFrom,CHOICE(?List:Control))

The ListFrom is a string containing the elements of the listcontrol, so
WHAT won't work in this context.


Sun, 14 Apr 2002 03:00:00 GMT  
 Return of selected element in listcontrol
WHAT(ListFrom,CHOICE(?List:Control))


Quote:
> Having a listcontrol where the FROM is set like:
>   Listfrom = 'Car|Plane|Boat'
>   ?List:Control{PROP:FROM} = ListFrom

> Using the  CHOICE(?List:Control)
> I'll get the selected elementnumber.

> But is there any runtime property which
> will return the value of the selected
> element? Since I'm not using a QUEUE
> I need to parse the string.

> Would like the choose to handle this like:
>   CHOOSE(CHOICE(?List:Control),'Car|Plane|Boat')



Sun, 14 Apr 2002 03:00:00 GMT  
 Return of selected element in listcontrol
Hi Bj?rn,

Thanks for your response and the code. That's probably the solution.

I hoped dough there could be some builtin function or runtime property
solution. Might not be.



Sun, 14 Apr 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Return selected application window on mousedown and return to Realbasic

2. print select elements from array

3. Array selecting elements

4. Selecting elements of an array using property nodes

5. How to select array elements?

6. HELP: Bit-select on array element???

7. $_POST, PHP, POSTGRES, SELECT ELEMENT

8. selecting array elements with a logical array

9. Selecting more than one element in a listbox

10. Selecting multiple elements of a list?

11. How to determine selected listbox elements?

12. selecting only one element of a listbox

 

 
Powered by phpBB® Forum Software