Liberty BASIC Community Forum
« wanna change color of a LINE in graphics ! »

Welcome Guest. Please Login or Register.
Mar 29th, 2017, 9:47pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: wanna change color of a LINE in graphics !  (Read 190 times)
Zabo
Full Member
ImageImageImage


member is offline

Avatar

Yes. It work's. ha


PM

Gender: Male
Posts: 110
xx wanna change color of a LINE in graphics !
« Thread started on: Jul 21st, 2016, 10:57am »

'===========================================LEVEL 3===============================================

[linetrack]
#zeichnen, "color white"
#zeichnen, "line "; startX; " "; startY; " "; oMouseX; " "; oMouseY
#zeichnen, "color " ; color$ 'wanna define here a color that is already chosen before , to change line color for current draw
'color$ is at the moment "red"
#zeichnen, "place "; startX; " "; startY
#zeichnen, "line "; startX; " "; startY; " "; MouseX; " ";MouseY
oMouseY = MouseY
oMouseX = MouseX
goto [input]
========================================

Hi ,

i want to change the color with a variable chosen before in the code in this Graphics tracking code.
Dont know how the exact syntax for this is.

Any help possible. I would appreciate it.

WBR

Zabo
User IP Logged

cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 602
xx Re: wanna change color of a LINE in graphics !
« Reply #1 on: Jul 21st, 2016, 1:23pm »

How do you want to do it, something like this for example:
Code:
'===========================================LEVEL 3===============================================
OPEN "err wrong title" FOR graphics_nf_nsb AS #zeichnen
#zeichnen "trapclose [quit]"
#zeichnen "when leftButtonDown [linetrack]"
color$ = "red"
#zeichnen "down;fill white;flush"
startX=16 : startY = 16

[linetrack]

#zeichnen, "color white"
#zeichnen, "line "; startX; " "; startY; " "; oMouseX; " "; oMouseY
colordialog color$, color$
#zeichnen, "color " ; color$ 'wanna define here a color that is already chosen before , to change line color for current draw

'color$ is at the moment "red"
#zeichnen, "place "; startX; " "; startY
#zeichnen, "line "; startX; " "; startY; " "; MouseX; " ";MouseY
oMouseY = MouseY
oMouseX = MouseX
'goto [input]
'========================================
wait

[quit]
close #zeichnen : end

 

« Last Edit: Jul 21st, 2016, 4:51pm by cundo » User IP Logged

cundo
Zabo
Full Member
ImageImageImage


member is offline

Avatar

Yes. It work's. ha


PM

Gender: Male
Posts: 110
xx Re: wanna change color of a LINE in graphics !
« Reply #2 on: Jul 21st, 2016, 2:55pm »

Hello cundo ,

if it is possible i want to make the command

#zeichnen, "color " ; color$

before

#zeichnen, "place "; startX; " "; startY


color$ is "red" , therefore a colordialog is normaly
not necessary here.

Only to define the color normal , if that is possible.

The color$ is defined in the beginning of the program
before the label of drawing a line is activated.

In that case only this command must be prepared :

#zeichnen "color black"

and changed to :

#zeichnen "color color$"

but that is not functioning in that syntax.

If it is possible , i can change the colors BEFORE

the LINE Label is called. example color$ = "green"


Regards

Hans



User IP Logged

tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1138
xx Re: wanna change color of a LINE in graphics !
« Reply #3 on: Jul 21st, 2016, 4:23pm »

The following code may help you with an example. Click at a series of places on screen and watch the line colour change.
Code:
open "Line color demo" for window as #zeichnen

#zeichnen    "trapclose [quit]"

#zeichnen.gb "down ; size 10 ; fill 40 40 160"
#zeichnen.gb "when leftButtonDown [paint]"

wait

[paint]
    scan
    #zeichnen.gb "color " ; color$( colorIndex)
    colorIndex =( colorIndex +1) mod 5
    newMouseY   = MouseY
    newMouseX   = MouseX
    #zeichnen.gb "line "; oMouseX; " "; oMouseY; " "; newMouseX; " "; newMouseY

    oMouseY     = newMouseY
    oMouseX     = newMouseX

    wait

[quit]
    close #zeichnen
    end
 

Since you only posted part of your code it's difficult to see exactly what you are trying to do..

PS It helps if you put BASIC listing between code tags, which you get by clicking the # icon on the message editor.
User IP Logged

cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 602
xx Re: wanna change color of a LINE in graphics !
« Reply #4 on: Jul 21st, 2016, 4:56pm »

There is something missing there John.

To Zabo, the syntax is : #zeichnen, "color "; color$

Code:
'===========================================LEVEL 3===============================================
OPEN " " FOR graphics_nf_nsb AS #zeichnen
#zeichnen "trapclose [quit]"
#zeichnen "when leftButtonDown [linetrack]"

#zeichnen "down;fill white;flush"
startX=16 : startY = 16

[linetrack]

color$ = "red"
#zeichnen, "color ";color$
#zeichnen, "line "; startX; " "; startY; " "; oMouseX; " "; oMouseY

color$ = "blue"
#zeichnen, "color " ; color$ 'wanna define here a color that is already chosen before , to change line color for current draw

#zeichnen, "place "; startX; " "; startY
#zeichnen, "line "; startX; " "; startY; " "; MouseX; " ";MouseY
oMouseY = MouseY
oMouseX = MouseX

'========================================
wait

[quit]
close #zeichnen : end

 
User IP Logged

cundo
Zabo
Full Member
ImageImageImage


member is offline

Avatar

Yes. It work's. ha


PM

Gender: Male
Posts: 110
xx Re: wanna change color of a LINE in graphics !
« Reply #5 on: Jul 22nd, 2016, 02:01am »

I got it.

Thank you for your help.

Syntax: #zeichnen "color black" is changed to

Syntax: #zeichnen "color " ; color$

That works.

What i program here is a complete rapid drawing program in basic language.
A program for "hands on mentality" in field service technician.

Why is the color here a problem?

Easy case.

For witing a line the linetrack branch makes to erase
all the mouse actions during the endpoint with WHITE.
The color must therefore be changed in the branch label.
Normally , if this erasing procedure is not happen
the predefined color is on the way and NO color is seen
in the complete linetrack label.
Switch to white and then to the chosen color is uptodate.

Level 3 mean that i have arranged the branch labels in categories of code flow.
1. Branch Label 1
2. first from 1
3. first from 2 (Level3)
to see where this branch label come from and what are directly connected to the main code.


Best Regards

Zabo


« Last Edit: Jul 22nd, 2016, 02:05am by Zabo » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls