I would like to produce a list of text to show the status of items. Each item needs a coloured indicator, to show at a glance its status, ie. green for open, red for closed. This page is likely to have 50 plus items As below I know this can be achieved with graphics boxes, how ever I would prefer this to be an icon or at least a circle without the border of a graphicbox.
Does anyone have any suggestions on the best why to achieve this?
You can show and hide various coloured controls. We can now change the color of each control at creation. So create a red, green, yellow one and position them all at the same place. Show only one, hide the other two. Your handlers should Manage which is on view/enabled
' filling the array of items and their states (pseudo file) Dim item$(50) a$="item1 stateA item2 stateB item3 stateB item4 stateA item5 stateB item6 stateA" For x=1 to len(a$) if word$(a$,x)="" then xx=x-1: exit for next x For x =1 to xx-1 step 2 item$(x)=word$(a$,x)+" "+word$(a$,x+1) next x ' we have the array of items and their states for x=1 to xx print item$(x) next x '--------------- NOMAINWIN WindowWidth = 700 : WindowHeight = 500 UpperLeftX = 10 UpperLeftY = 10 graphicbox #opn.g1,5, 5, 683, 455 Open "Window Title" for window as #opn #opn, "trapclose [quit]" #opn.g1, "down ; fill lightgray" x=20: y=20: t=1 for a=1 to xx if y > 400 then x=x+160: y=20 end if gosub [graph] next a wait [graph] if word$(item$(a),2)="stateA" then gosub [redi] if word$(item$(a),2)="stateB"then gosub [greeni] return [redi] #opn.g1, "color red;backcolor red" #opn.g1, "place ";x;" ";y: #opn.g1, "boxfilled ";x+20;" ";y+20 #opn.g1, "color black;backcolor lightgray" #opn.g1, "place ";x+50;" ";y+15: #opn.g1, "\ ";word$(item$(a),1) y=y+30: t=t+1 return
Post by Brandon Parker on Jun 13, 2020 21:57:23 GMT -5
You can do this through the use of the Windows API and WMLiberty.dll. Brent created an example a long time ago to change the color of TextBoxes, but it can be changed to change the color of StaticTexts just the same. If this is something that you would like, I can throw together a simple example tomorrow if I get the time.
For now, here is what it would look like. This window was created using the method above, but I would like to change the code around if it is to be posted.
Just let me know if you would like to see how it is done.
Windows 7 Home Premium 64-bit Intel(R) Quad Core(TM) i5 CPU M 430 @ 2.27GHz 4GB DDR3 RAM