Colors in "self-made" queue-browse 
Author Message
 Colors in "self-made" queue-browse

Hi!

I have a "self-made" queue which I display in a non-template ListBrowse.
Is it possible to use conditional colors for the records in the browse?

If it is, how should it be done. If it's not possible, that
answer would help me too.

Thank you

Bjorn Kaustell



Sun, 05 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

Hi Bjorn,

On Sat, 20 Sep 1997 16:17:53 +0300, Bjorn Kaustell

Quote:

>> I have a "self-made" queue which I display in a non-template ListBrowse.
>> Is it possible to use conditional colors for the records in the browse?
>In the queue you have to add four fields directly after Field2.

>abcQUE        QUEUE
>Field1                      BYTE
>Field2                      STRING(10)
>Field2:NormalFG     LONG
>Field2:NormalBG     LONG
>Field2:SelectedFG           LONG
>Field2:SelectedBG   LONG
>Field3                      STRING(10)
>      END

>Then somewhere in the code where you build the queue you give the colors
>to the fields using whatever conditions you want.

>Field2:NormalFG     = COLOR:Red
>Field2:NormalBG     = COLOR:Yellow
>Field2:SelectedFG           = COLOR:Navy
>Field2:SelectedBG   = COLOR:Green
>            ( horrible combination )

This should work fine.  If you have a big queue with lot of fields
that you want to use colours with, this can be quite a lengthy code,
both for the queue and when setting the colours, specially if they are
conditional<g>

Now, this no only applies to colours, but also to icons.  To place an
icon in a queue listbox, you would have something like:

LOC:MyQueue    QUEUE,PRE()
LOC:TextField    STRING(20)
LOC:IconField    LONG
               END

The LOC:IconField holds only the number for the icon to use.  In the
"Preparing to process the window" embed, you would use:

 ?List{PROP:Iconlist,1} = 'myicon1.ico'
 ?List{PROP:IconList,2} = 'myicon2.ico'
 ?List{PROP:IconList,3} = 'myicon3.ico'
 ?List{PROP:IconList,4} = 'myicon4.ico'

When you fill in the queue, you would use:

 LOC:TextField = 'First field'
 LOC:IconField = 1
 ADD(LOC:MyQueue)
 LOC:TextField = 'Second field'
 LOC:IconField = 2
 ADD(LOC:MyQueue)

Then of course you must add the icon to the listbox in the listbox
formatter;)

When you run the program, it will display the two records, record one
showing myicon1.ico because the iconfield has 1 as value and record
two showing myicon2.ico because the iconfield contains 2.  I have just
used this to build a listbox with diskdrives and appropriate icons
depending on if the drive is removable, fixed, cd-rom, network or ram
drive.  Works fine:)

Best regards,

Arnor Baldvinsson
Allerup Edb
Tel: +45 4675 7122
Fax: +45 4675 7144
Denmark


http://www.icetips.com
UIN nr.: 2428601



Wed, 08 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

Quote:

> Hi!

> I have a "self-made" queue which I display in a non-template ListBrowse.
> Is it possible to use conditional colors for the records in the browse?

> If it is, how should it be done. If it's not possible, that
> answer would help me too.

> Thank you

> Bjorn Kaustell

Hi again !

After many cops of coffee and lots of time I at last found an answer. I
don't know if this is the best solution, but it seems to work.

I looked into the listbrowse made by the template, it adds four
fields to each field in the queue you want to colorize.

If you have a "home-made" queue, that you want to show in a window
(without a tempalte) just using a listcontrol and the queue looked like
this

abcQUE    QUEUE
Field1  BYTE
Field2  STRING(10)
Field3  STRING(10)
          END

and you want to colorize the second field. You have to check in the
appgen in the listboxformat window color cells (or something like that)

In the queue you have to add four fields directly after Field2.

abcQUE    QUEUE
Field1                  BYTE
Field2                  STRING(10)
Field2:NormalFG         LONG
Field2:NormalBG         LONG
Field2:SelectedFG       LONG
Field2:SelectedBG       LONG
Field3                  STRING(10)
          END

Then somewhere in the code where you build the queue you give the colors
to the fields using whatever conditions you want.

Field2:NormalFG         = COLOR:Red
Field2:NormalBG         = COLOR:Yellow
Field2:SelectedFG       = COLOR:Navy
Field2:SelectedBG       = COLOR:Green
                ( horrible combination )

The order in the queue is important !
Hope this helps someone

Bjorn Kaustell



Wed, 08 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse



Quote:
> Hi!

> I have a "self-made" queue which I display in a non-template ListBrowse.
> Is it possible to use conditional colors for the records in the browse?

> If it is, how should it be done. If it's not possible, that
> answer would help me too.

> Thank you

> Bjorn Kaustell

Queue   QUEUE,PRE(Q1)
Field1  AnyType1
NormalForeGround        LONG
NormalBackGround        LONG
SelectForeGround        LONG
SelectBackGround        LONG
        ....
        END
        ....

        if AnyCondition
                Q1:NormalForeground = Color1
                Q1:NormalBackGround = Color2
                Q1:SelectForeGround = Color3
                Q1:SelectBackGround = Color4
        end

        You may add this text for each field in the Queue (ListBox)

--
Popov Pavel




Sat, 11 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse



Quote:
> Hi!

> I have a "self-made" queue which I display in a non-template ListBrowse.
> Is it possible to use conditional colors for the records in the browse?

> If it is, how should it be done. If it's not possible, that
> answer would help me too.

> Thank you

> Bjorn Kaustell

        Hi Bjorn Kaustell!

Test    QUEUE
Field1                  AnyType1
NormalForeGround        LONG
NormalBackGround        LONG
SelectForeGround        LONG
SelectBackGround        LONG
Field2                  AnyType2
        ...
        END

        ...

        if AnyCondition(Field1)
                NormalForeGround = Color1
                NormalBackGround =  Color2
                SelectForeGround = Color3
                SelectBackGround = Color4
        end

        You may add this text for each field in the ListBox

        Popov Pavel




Sat, 11 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

Is it not easier to maintain colors with a second queue in some way?

Like this:

MainQueue queue,pre()
field1 anytype
field2 anytype
     end

Colorqueue queue,pre()
Ref_Pointer long
Ref_field      long
Ref_NormalFG            LONG
Ref_NormalBG    LONG
Ref_SelectedFG          LONG
Ref_SelectedBG  LONG
        end

some code:

  Ref_pointer=pointer(mainqueue)
  Ref_field   = ?field() ! This is the problem part of it
  Ref_NormalFG = colour:none
   ......

It should then be possible to make some general code for all queue's
using colours.

Quote:


>> Hi!

>> I have a "self-made" queue which I display in a non-template ListBrowse.
>> Is it possible to use conditional colors for the records in the browse?

>> If it is, how should it be done. If it's not possible, that
>> answer would help me too.

>> Thank you

>> Bjorn Kaustell
>Hi again !
>After many cops of coffee and lots of time I at last found an answer. I
>don't know if this is the best solution, but it seems to work.
>I looked into the listbrowse made by the template, it adds four
>fields to each field in the queue you want to colorize.
>If you have a "home-made" queue, that you want to show in a window
>(without a tempalte) just using a listcontrol and the queue looked like
>this
>abcQUE        QUEUE
>Field1      BYTE
>Field2      STRING(10)
>Field3      STRING(10)
>      END
>and you want to colorize the second field. You have to check in the
>appgen in the listboxformat window color cells (or something like that)
>In the queue you have to add four fields directly after Field2.
>abcQUE        QUEUE
>Field1                      BYTE
>Field2                      STRING(10)
>Field2:NormalFG     LONG
>Field2:NormalBG     LONG
>Field2:SelectedFG           LONG
>Field2:SelectedBG   LONG
>Field3                      STRING(10)
>      END
>Then somewhere in the code where you build the queue you give the colors
>to the fields using whatever conditions you want.
>Field2:NormalFG     = COLOR:Red
>Field2:NormalBG     = COLOR:Yellow
>Field2:SelectedFG           = COLOR:Navy
>Field2:SelectedBG   = COLOR:Green
>            ( horrible combination )
>The order in the queue is important !
>Hope this helps someone
>Bjorn Kaustell



Sat, 11 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

My UltraTree for C4 template OOP methods will be using a technique
similar to your description, involving an auxiliary queue defined as
part of the Ultratree object.

The basic idea is to define the colors in both the main queue and the
auxiliary queue as arrays, and use CW reference variables stored in the
auxiliary queue to copy the appropriate arrays to the main queue.

I expect this to be more efficient than current methods.

Surprisingly, so far, the C4 OOP BrowseBox handles colors "the old
fashioned way".

Quote:

> Is it not easier to maintain colors with a second queue in some way?

> Like this:



Sat, 11 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

Quote:

> The basic idea is to define the colors in both the main queue and the
> auxiliary queue as arrays, and use CW reference variables stored in the
> auxiliary queue to copy the appropriate arrays to the main queue.

Interesting, I tried something like this but got a run-time error
because wsl expects 4 distinct longs.  Has this changed for C4?

--------------------------------------------------------------------
From: Sean Wilson               WebSite: http://www.GreyMatter.co.uk
Post: Grey Matter Ltd., Prigg Meadow, Ashburton, Devon, UK. TQ13 7DF
Tel: +44 (0)1364 654 100                    Fax: +44 (0)1364 654 200



Sun, 12 Mar 2000 03:00:00 GMT  
 Colors in "self-made" queue-browse

Sean,

Thank you for the insight.

I haven't actually tried grouping or arrays in the main queue.  Your
experience may well be applicable to C4.  So far, this is still in the
conceptual stage.  I have been busy converting to the use of ABCs before
tackling definition of my own classes.

If necessary, I will use a GROUP of 4 LONGs OVER the array in the colors
queue (or vice versa) and then move individual LONGs to the main queue.
This code will be in a class method. I am mainly interested in
optimizing parameter passing, and in the ability to manipulate and
reference single encapsulated entities at the higher levels.  If it
requires 4 moves at the bottom, it won't be a big deal for me.

Quote:

> > The basic idea is to define the colors in both the main queue and the
> > auxiliary queue as arrays, and use CW reference variables stored in the
> > auxiliary queue to copy the appropriate arrays to the main queue.

> Interesting, I tried something like this but got a run-time error
> because wsl expects 4 distinct longs.  Has this changed for C4?

> --------------------------------------------------------------------
> From: Sean Wilson               WebSite: http://www.GreyMatter.co.uk
> Post: Grey Matter Ltd., Prigg Meadow, Ashburton, Devon, UK. TQ13 7DF
> Tel: +44 (0)1364 654 100                    Fax: +44 (0)1364 654 200



Sun, 12 Mar 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. "self revisitBeforeWaveRelease"

2. "Self modifying" code

3. Bring "self" to top

4. interpret "self~"methodname

5. - Ruby and the "Self Problem"

6. SCOOPS and "self"

7. self-rep programs or "quines"

8. "self-reference" challenge

9. "Self referring" affectations

10. Emacs: highlighting "self" tweak

11. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

12. ".w configure" for self defined widgets

 

 
Powered by phpBB® Forum Software