xelos said:
I'd like to make a dropdown-list which shows custom values in different colours.
Do you mean you want to be able to click on a field and have a dropdown list appear with the values in the dropdown list
showing up in different colors? (see screen shot)
That is not a FileMaker native feature. (In fact, native dropdown lists appear in the formatting of the field to which they are attached, so you can't display different values in different fonts, font sizes, font styles, colors, or anything of the sort)
If it is of sufficient importance to you, you can create such an interface but you'll have to create your own replacement for the native dropdown value list in order to do so.
Quick -n- dirty example: Create a duplicate of the layout on which you wish to have the value list operate. On the duplicate layout, superimpose a set of global text fields — as many fields as your actual valuelist (is likely to) have values, placed in a vertical stack so as to look like a value list is dropping down from the field to which the valuelist would be attached. Remove all fields from the tab order except the global fields I just described. Create a script that sets the colors and contents of the global fields to the values of the applicable value list plus the colors you want to use. e.g. —
Code:
Set Variable [ $ValueListItems; Value:"¶"&ValueListItems ( Get(FileName) ; "MyValueList" )&"¶" ]
Set Variable [ $Rep; Value:1 ]
Go to Layout [ original layout ]
Go to Field [ tempsave::PhonyVL.global ]
Loop
Exit Loop If [ IsEmpty(Middle($ValueListItems; Position($ValueListItems; "¶"; 1; $Rep)+1; Position($ValueListItems; "¶"; 1; $Rep
+1)-Position($ValueListItems; "¶"; 1; $Rep)-1)) or not IsValid(Middle($ValueListItems; Position($ValueListItems; "¶"; 1; $Rep)
+1; Position($ValueListItems; "¶"; 1; $Rep+1)-Position($ValueListItems; "¶"; 1; $Rep)-1)) or $Rep > 10 ]
Set Variable [ $Red; Value:Case($Rep=1; 244;
$Rep=2; 245;
$Rep=3; 0;
$Rep=4; 0;
$Rep=5; 255;
$Rep=6; 120;
$Rep=7; 255;
$Rep=8; 0;
$Rep=9; 120;
$Rep=10; 255) ]
Set Variable [ $Green; Value:Case($Rep=1; 11;
$Rep=2; 245;
$Rep=3; 254;
$Rep=4; 5;
$Rep=5; 5;
$Rep=6; 75;
$Rep=7; 75;
$Rep=8; 255;
$Rep=9; 120;
$Rep=10; 120) ]
Set Variable [ $Blue; Value:Case($Rep=1; 5;
$Rep=2; 0;
$Rep=3; 0;
$Rep=4; 255;
$Rep=5; 255;
$Rep=6; 120;
$Rep=7; 120;
$Rep=8; 255;
$Rep=9; 0;
$Rep=10; 0) ]
Set Field [ TextColor ( Middle($ValueListItems; Position($ValueListItems; "¶"; 1; $Rep)+1; Position($ValueListItems; "¶"; 1; $Rep
+1)-Position($ValueListItems; "¶"; 1; $Rep)-1) ; RGB ( $red ; $green ; $blue ) ) ]
Go to Next Field
Set Variable [ $Rep; Value:$Rep + 1 ]
End Loop
(code text assumes FileMaker 8; you can do this in FileMaker 7 but you'll need global fields to substitute for all the variables as Fm7 didn't have "Set Variable" as a script option; code text assumes Value List is limited to 10 items max, adjust accordingly for a longer possible VL)
Then, for each global field, create a script that sets the original field to the value clicked on and return the user to the original layout, and attach those scripts to the applicable global field as buttons.
Now, if you just want a valuelist consisting of color NAMES, which, upon being selected, changes the color of the field as displayed, etc.,. that's easier and more natively supported.