Get ?List Control Data Value from external Class

Hi, guys!

It is necessary to obtain information of contents Value (not attributes (not properties)) of elements of a Control ?List which dynamically receives an infomation from a third-party class and to appropriate values to STRING variables

WINDOW  WINDOW('Window'),CENTER,GRAY,IMM,SYSTEM,MAX
                  LIST,AT(10,100),USE(?List),VSCROLL
   END

CODE

OPEN (WINDOW )

DR.Exec( InputString, ?List )

DISPLAY()

Not sure I understand what are you talking about.

Anyway, you can’t just declare LIST as per your example. The data items displayed in the LIST come from a QUEUE or STRING specified by the FROM attribute and are formatted by the parameters specified in the FORMAT attribute (which can include colors, icons, and tree control parameters).

The example works without problems, it is necessary to receive value of contents of each element

I think there are no documented ways to get external data source (queue defined in black box) from list control.

It might help if you told us what the DR object was.
Is it a 3rd Party Clarion add-on, if so it may expose the internal queue structure as a reference.

Graham

1 Like

Try ?List{Prop:From} and see what you get.

InputString = 'One|Two|Three|Four'

DR.Exec             procedure(string pInput,long pControl)
    code
        pControl{PROP:From} = pInput

If the Class method is as the above and simply assigns a string to the list then PROP:From will show you the values in the string.

PropFrom

Graham

FormatSTR = ?List{PropList:Format}
Loop Loc:xCount = 1 to ?List{PropList:Exists,0} by 1
If ?List{PropList:Exists,Loc:xCount} = True

                      FieldNo = ?List{PropList:FieldNo , Loc:xCount}
       
                      LOC:CurrentValue =  FieldNo
                      MESSAGE(LOC:CurrentValue)

                      HeaderValue     = ?List{PropList:Header     ,             Loc:xCount} 
                      
                      LOC:CurrentValue =   HeaderValue
                      MESSAGE(LOC:CurrentValue)

It is necessary to receive value of maintenance of elements
?List, but I receive only properties :sleepy:

Possible decisions in the Clarion code?

The PropList properties will only get parts of the listbox format string - they won’t retrieve values from the rows or columns of the list.

Clarion list controls are ‘owner drawn’ which means the normal Windows API methods of getting items from the list control won’t work.

If you have the code for the DR Class then somewhere in there will be a QUEUE (probably marked PRIVATE).
If you remove the PRIVATE attribute it will be accessible to your code - then you may be able to do something like…

LOC:CurrentValue = GET(DR.InternalQueue,?List{prop:selected})

But the GET syntax will depend upon the declaration of that internal queue.

Graham

OK final response from me.

You’re using a completely non-standard way of accessing a database using this free Class

which uses direct ODBC calls to the backend and and virtual listbox !

It’s best to stick to the standard Clarion way of doing things or at least use 3rd Party tools that provide support.

I can’t get that Class to work at all using SQL Server but looking at the declarations in ODBCClass.inc it seems there are four Class methods provided to access the selected row or cell in the listbox…

Fetch                     PROCEDURE( STRING column, STRING value ), LONG, PROC
Get                       PROCEDURE( STRING column ), STRING
GetCurrentRow             PROCEDURE, LONG
GetCell                   PROCEDURE( LONG row, SHORT column ), STRING

?List{PROP:Selected} will get you the selected row and look at proplist:mousedownrow etc to get the selected cell.

Graham

Graham, I thank for prompt response!

It means that to receive values of queue from a ?List Control of an opportunity is not present?

No it means you need to use the methods of the Class eg

LOC:CurrentValue = DR.GetCell(?List{prop:Selected},1) !*** to get contents of column one ***

Graham

Graham, I thank!

Yes, I checked, this LOC:CurrentValue = DR.GetCell works.

And how now to transfer all values of cells of result of a request to queue and do parsing?

If you read the class, you’ll see the results are already in the queue
DR.ResultSet which is a &ODBCRowsType

Beware of using ASTRING (there is a compile time switch)
If you do, each unique value will be persisted as long as the program is open.

Thank you Mark Goldberg!

Thank you for pointing me in the right direction, at least in the help files.
Is there a way to right justify a field at runtime, without affecting the entire column?
IF MyFielRight = 1
?List{PROPLIST:Right,2} = TRUE
Else
?List{PROPLIST:Left,2} = TRUE

This affects the entire column.

Thanking all for contributing.

Does this have anything to do with this topic from 2018? Start a new topic or post on the right one.

I would have thought PROPSTYLE had alignment but I don’t see it. You could make it a STRING and pad with spaces. Style could use a Fixed Width Font.

1 Like