Subscribe to this thread
Home - General / All posts - how to change the color of the drawing via script..
qwer4 post(s)
#26-Jul-10 19:43

im a newbie in manifold gis , please help with this one

hdl44 post(s)
#26-Jul-10 21:37

What aspect of the drawing do you want to change AreaBackground, AreaForeground, AreaBorderForeground, LineForeground.

You may want to read the Programming Reference for the Theme Object Here

KlausDE

6,410 post(s)
#26-Jul-10 21:41

... or this old thread.


Do you really want to ruin economy only to save the planet?

qwer4 post(s)
#26-Jul-10 22:11

Thanks for reply, all of the above, this is the process i want to solve: i have a table, which has a status field, if the status is 1(w/c means paid) the color of the drawing should be Green , if 0(w/c means unpaid) the color of the drawing should be Red . Hope you can give a script Please.

Sloots

678 post(s)
#26-Jul-10 22:22

If I read between the lines correctly, I think you don't need a script at all. Change the color of your drawing using thematic formatting from the UI.

Open the drawing, choose e.g. backgroundcolor in the toolbar and select Theme. Your field of choice is "status", choose unique values, and assign the right color to each value.

If new items to your drawing are added the will have the correct color right away.

Cheers,

Chris


http://www.mppng.nl/manifold/pointlabeler

qwer4 post(s)
#26-Jul-10 22:39

Thx for your reply :D, i think i need a script on this one, because i used database to modify the color of the drawing depending on the status w/c i stated above...

KlausDE

6,410 post(s)
#27-Jul-10 09:40

I think Sloots is right. What you changed through the DB is not the color but the value of the column [Status] the formating should be based on. Formating is done completely inside Manifold independent on the source of the data. You can only change format if you have objects of all the values (0 | 1 in your case) that should be distiguished.

So open a Drawing with points of both possible values of [Status] and select "Theme..." at the bottom of the color table that pops up below button 'Point Background' and select the colors for each value.

Now each time value [Status] is changed Manifolds displays the other color. You can play with this interactively using colum [Selection (I)] - but you must have selected and unselected points when you open the formating dialog. As an aside it's not enought to have a selected area but all unselected points. the 'Point Backgraund will not offer formatings for values that are not present in the set of points.


Do you really want to ruin economy only to save the planet?

volker

1,086 post(s)
#30-Jul-10 01:53

for a quick formatting use the [Drawing->Color..] dialog.

Look at the help under "Color a Drawing".

The color dialog is UI-scriptable.

And the "Drawing Object" ("Drawing" in the help)

is scriptable, too.

Your [w/c] column should be a boolean value.


http://www.thegisservicesector.de

volker

1,086 post(s)
#30-Jul-10 02:30

I found another way to do this.

Using UI-Script you can control the Format toolbar.

In the attached map look at the [Drawing].

All points are in grey. If you run the script

with the "!", all points with value "0" in the [Color]-column

are red and all points with value "1" are green.

The trick is to use the "ComboBoxPalette".Text = "Greens and Reds"

do a "push" to "EditFormatApply" and after this do a

"EditFormatReverse".Push, without the Reverse.Push the

fields with "0" are green and the "1" are red.

Hope this helps. Look at the attached map.

Attachments:
Format_PointBackground_UI-Script.map


http://www.thegisservicesector.de

volker

1,086 post(s)
#30-Jul-10 02:36

and the same with AreaBackground....

Attachments:
Format_AreaBackground_UI-Script.map


http://www.thegisservicesector.de

bcatungal9017 post(s)
#11-Jun-15 04:00

Hi if there is possible that the color may change based on the specific value given on a column.

Here is the code i revise from Format_AreaBackground_UI-Script, when i run the script it will not respond can you check it, and i remove the reverse from the original code.

Set d = Document.ComponentSet.Item("Drawing")

d.Open

Set ui = Application.UserInterface

ui.Toolbars.Item("Format").ControlSet.Item("EditFormatAreaBackground").PushNamed("Theme")

Do ' Nothing

Loop Until ui.DisplaysModalDialog

Set dlg = ui.ModalDialog

With dlg.ControlSet

.Item("CheckBoxPreview").Checked = True

.Item("ComboBoxColumn").Text = "CONSUMPTION"

if .Item("Values").Text < 14 THEN

.Item("ComboBoxMethod").Text = "Unique Values"

.Item("ComboBoxPalette").Text = "Reds"

.Item("EditFormatApply").Push

else

if .Item("Values") > 14 THEN

.Item("ComboBoxMethod").Text = "Unique Values"

.Item("ComboBoxPalette").Text = "Greens"

.Item("EditFormatApply").Push

else

if .Item("Values") = 14 THEN

.Item("ComboBoxMethod").Text = "Unique Values"

.Item("ComboBoxPalette").Text = "Yellows"

.Item("EditFormatApply").Push

end if

end if

end if

.Item("ButtonOK").Push

End With

dlg.Accept

tjhb
10,094 post(s)
#11-Jun-15 05:12

This would be much easier to read if you could use the Insert Code button.

But it looks as if the main problem is that you are not using VBScript's conditional syntax correctly.

If... Then

    ...

ElseIf ... Then

    ...

Else

    ...

End If

Have a read of the Windows Script 5.6 Documentation (you need this on-hand).

In this case especially the section—

VBScript

    VBScript Language Reference

        Statements (VBScript)

            If ... Then ... Else Statement

—where you can find some helpful examples.

bcatungal9017 post(s)
#11-Jun-15 06:18

hi sir, what do you mean on "This would be much easier to read if you could use the Insert Code button."

uhmm, i tried to revise again the code i post with the hint you gave still no success. i know it's so much to ask but i will. can you show me some example sir.

tjhb
10,094 post(s)
#11-Jun-15 06:44

No.

Perhaps reread my previous post more carefully.

bcatungal9017 post(s)
#11-Jun-15 09:25

ok sir i will thanks again.

tjhb
10,094 post(s)
#11-Jun-15 11:17

By the way this is not a place where we address each other as Sir or Madam (even without capitals).

We just respect each other.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.