I have 2 List controls. I fill the corresponding Queues with fixed amount of records. I want to conditionally display an Icon but can not find any example of this. There is no SetQueueRecord and I feel myself lost in the Docs. I don’t want to use browse. I use the second List as a second column of the same list /with nxt 20 records/ or as a different filter list from the same file.
Any ideas about the Icon ?
Thanxs
I did it that way but ?List1{PROP:IconList,1} = ‘~D:\C10\Images\Icons\Careful16.ico’
doesn’t work in List control. in other application /which I renamed and create a new one/ the same in Browse is Ok.I changed it to ?List1{PROP:IconList,1} = ‘~…..\Images\Icons\Careful16.ICO’ and now it is Ok.
You should be able to just use the file name: ?List1{PROP:IconList,1} = '~Careful16.ICO'.
IMO you do NOT want to use an absolute Path to Images (icons) in your code like D:\xxx because it makes it hard to move the code to a different machine. The simplest thing to do is to copy the file into the project folder. Or setup so the Icon to be found via the RED. Or better they can be in a subfolder of the project accessible by a relative path (.\Icons or ..\Icons) so the project can be easily moved/copied. That also makes it easier to change all the icons for a new look since they are in 1 folder.
The LibMaker example has an Icon in the List. This repeats most of what Simon said…
List From Queue needs Icon Number after field. Normally a LONG. The label “Icon” is a bit short and messy to search as you’ll find many references to substring “Icon”. I would use anything longer: e.g. IconNo, IconSymbol or Symbol_Icon.
LIST has Icon specified for Column which is “I” in Format, or “J” for transparent. The “T” is Tree.
LIST properties are used to specify PROP:IconList with Icon names for each number.
The Queue Icon field is used to set the Icon displayed:
Tip: You can include Icons in the project with code PRAGMA ('link (careful16.ico)')
I always use “Libraries, Objects and Resource Files” to include everithing I need inside app.
There were no errors during compile /external resource/. I suppose the problem arise because I saved existing app to another name and change what needed. When I re-enter the icon in “Libraries, Objects and Resource Files” the problem solved. Everithing was done properly.
I really like to use Equates for the Icons
I feel it greatly improves the readability and maintainability of the code
The following a small part of some production code
There are even more
WallList:Icon ITEMIZE(),PRE
RECTANGULAR EQUATE
GABLE EQUATE
SLOPE_LEFT EQUATE
SLOPE_RIGHT EQUATE
END ! and another dozen removed for brevitiy
! The actual values here do not matter
! (as long as they fit in the variable they are being stored in)
! Remember the values are not being saved / restore
! We just care that each one is unique
gtWallBrowse GROUP,TYPE
Shape STRING(6)
Shape:Icon SHORT
! and many more removed for brevity
END
ctQ_UI_Walls.GetShapeIcon PROCEDURE(CONST *gtRec_Wal xWall)!,LONG
Answer LONG,AUTO
CODE
CASE FmWal.EffectiveWallShape( xWall )
OF WallShape:Rect ; Answer = WallList:Icon:RECTANGULAR
OF WallShape:Gable ; Answer = WallList:Icon:GABLE
OF WallShape:SlopeL ; Answer = WallList:Icon:SLOPE_LEFT
OF WallShape:SlopeR ; Answer = WallList:Icon:SLOPE_RIGHT
! and more removed for brevity
END
RETURN Answer
ctQ_UI_Walls.FileToBuffer PROCEDURE(CONST *gtRec_Wal xWall, *gtWallBrowse xBuf)
CODE
! many lines removed for brevity
xBuf.Shape:Icon = SELF.GetShapeIcon( xWall )