LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can insert the color palette into the list box control ?

Hello,

The question just be as the title, I think using the function to let the user to change the text or a curve's color selected by their self. If it can be achieved , how to do ? I noted that there is a sample shiped by CVI , the listdelx.prj , but I don't want to use this chage color way , I just want to insert the color button in the list box . by the way , can you advise me the syntax "sprintf (blankItem, "\033p%dl\033vline\033p%dl\033vline\033vline", vertDivision1, vertDivision2);", I do not understand the means of "%dl , %vline , where can I find its definition ? Thanks.


David
0 Kudos
Message 1 of 4
(3,420 Views)
Hi David,

Unfortunately you cannot embed controls into a list box, so it's not possible to obtain the desired efect this way. What you can do is to trap some event on the list box and operate consequently. Usually I put a callback on the control and trap the right-click event, next from mouse cursor I determine the row clicked on and run a popup menu with a list of options for that particular item: I should have put an example of this somwhere in the forum but now I cannot find it back. Later I will post one, it's only a few lines of code.

As per the syntax of the item, its description lies somewhere in the help for the library: I'll be more precise when I came in my office, but here some hint: all items start with a \033 that instructs the listbox that what follows is a special code.

\033p%dl: "p" means pixels, %d is the amont of pixels required (you could write it down in clear if it's constant) and "l" means left-align (you could use "c" as well as "r" with obviour meanings). So \033p120l states that the following text will be written at 120 pixels position and left aligned
\033vline means insert a vertical bar at the cursor position (set by the previous \033p statement)

There are also a few other control codes for determining color of text: you'll see in the documentations.

Hope this helps
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,418 Views)
Documentations on various possible options for a list item can be found in the on-line help for "Item label" field in InsertListItem command.

For the listbox ability to run a popup menu you do not need anything special (I was confusing with table control that need some special effort to determine the current cell clicked): simply create your own menu and run it with RunPopupMenu provided to pass the function eventData2 for Top parameter and eventData1 as Left parameter so that the menu is shown at mouse position. You can highlight the row clicked and determine the actual index using the method shown in the example you mentioned in your question.

Message Edited by Roberto Bozzolo on 05-06-2005 10:24 AM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,417 Views)
Hi Roberto , thank you for all of you replies .


David
0 Kudos
Message 4 of 4
(3,394 Views)