×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    83

    Background Clor of a control

    Hello,

    I want to do a really simple thing, but i am unable to find how to do it here at the foruns os in the SDK help.

    I want to define the background color of a control. My aplication will define many controls:


    -------------------
    |..........................|
    |..------...------....|
    |.|...2..|..|..3....|...|
    |.|.......|..|.......|...|
    |..------...------ ...|
    |...........1.............|
    |..........................|
    -------------------

    1, 2 and 3 are controls. The application may load things, such as images, on the controls or not. Those things may be loaded in the entire control or not. The background color of the control must appear on not-loaded parts of the control.

    You can see a control like an region with a background that may be filled by elements. Where it is not filled, the background color must appear.

    How can i define background colors for controls?

    Thanks in advance,
    Vitor.

  2. #2
    Super Contributor
    Join Date
    May 2003
    Location
    Vancouver, Canada
    Posts
    985

    Re: Background Clor of a control

    Are you trying to make a transparent control?

    If you are, then try to override CCoeControl:raw() method. Then you need to draw your "element" using CWindowGc::BitBltMasked(). The important is that you need to create a mask for your element. The mask shall be a monochrome bitmap (black and white). The black represents part of the "element" that shall be drawn on the screen. The white one will be "hollow" -> meaning the background of parent's control will be displayed.

    Does it answer your question?

    Antony
    Antony Pranata
    http://www.antonypranata.com/
    http://www.s60tips.com/

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    83

    Re: Background Clor of a control

    I am trying this also. But first i was trying to define a background color to the control. I used SetBrushColor() and it worked for background.

    c1->BakgroundColor.SetRed(0);
    c1->BakgroundColor.SetGreen(255);
    c1->BakgroundColor.SetBlue(0);
    c1->BakgroundColor.SetAlpha(100);

    Then i do, inside of c1 constructor, SetBrushColor(BakgroundColor).

    However, i dont' know if the transparency of SetAlpha applies to others elements contained on the control. Lets say i load an image in this control. This image will appear with transparency?

    Also, there is anyway to define something like an zindex for controls?

    Thanks!!!!!!!!!!!!!
    Last edited by vitormcruz; 2007-10-11 at 18:24.

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    83

    Re: Background Clor of a control

    I tryed to load an image in a control with SetAlpha(10). Something strange happens. First the image does not appears transparent. Ok, but i realized that the color set for the brush was drawn in front of the image.

    So, higher the alpha, lesser of the loaded image can be seen.

    That mean i could not find a proper way to put a background color to the control....

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    83

    Re: Background Clor of a control

    I tryed use MCoeControlBackground. It didn't work. But i figured out what i was doing wrong. I put the gc.Clear() after draw the mage. Putting it before draw the image solved the problem :P

Similar Threads

  1. Skin background in custom control
    By template60 in forum Symbian User Interface
    Replies: 9
    Last Post: 2008-03-25, 11:47
  2. Replies: 1
    Last Post: 2007-10-04, 06:36
  3. Leave backlight control to operating system when app is in background
    By manupeco in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2007-03-18, 09:07
  4. Replies: 1
    Last Post: 2004-11-25, 03:42
  5. BUG: No background light and vibrator control
    By apriori in forum Mobile Java General
    Replies: 0
    Last Post: 2003-03-29, 12:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×