BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-24-2008, 09:38 AM   #1
Amit_kk
New Member
 
Join Date: Sep 2008
Model: 8300
PIN: N/A
Carrier: Vodafone
Posts: 4
Default How to use setGlobalAlpha value in popupscreen

Please Login to Remove!

Hello Everybody,

I want to create the semitransparent popup screen. I have read somewhere in API. Use setGlobalAlpha to set the Transparency.

How to use this API in application.

Any help will be appreciated.

if possible please explain with code snippet.

Thanks in advance.
Offline  
Old 09-24-2008, 10:49 AM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Global Alpha - from API doc

public void setGlobalAlpha(int alpha)

Sets the current global alpha value for drawing operations. It ranges from 0 (fully transparent) to 255 (fully opaque).

Be sure to reset the global alpha value when appropriate since all subsequent operations are done using the value specified. Global alpha is stored on the stack so popContext will restore it to the previous value.

Note that alpha will be clamped to the range 0-255.

Parameters:
alpha - Alpha value to use, from 0 (fully transparent) to 255 (fully opaque).
Since:
JDE 3.7.0
Category:
Colour: Pertains to devices' ability to display colour. May only be applicable on colour devices.
Offline  
Old 09-24-2008, 10:51 AM   #3
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

This is from the class Graphic. Your paint() method is passed the Graphic object, os this is where you would place your call to setGlobalAlpha().
Offline  
Old 09-26-2008, 06:20 AM   #4
Amit_kk
New Member
 
Join Date: Sep 2008
Model: 8300
PIN: N/A
Carrier: Vodafone
Posts: 4
Default

How to remove the stored alpha value ?

protected void paintBackground(Graphics g) {
try {
XYRect myExtent = getExtent();
int color = g.getColor();
int alpha = g.getGlobalAlpha();
g.setGlobalAlpha(0xCC);
g.setColor(0x000000);
g.fillRoundRect(0, 0, myExtent.width, myExtent.height, 30, 30);
g.setColor(color);
g.setGlobalAlpha(alpha);
} catch (Exception e) {
System.out.println(e.toString());
}
}

I have created the transparent screen using the above code but when I am changing focus (i.e I am moving the focus from one to another field ) at that time the transparency looses.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter picture

LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter

$9.95



Digital Multimeter Voltmeter Ammeter AC DC Volt Ohmmeter Tester Meter Auto Range picture

Digital Multimeter Voltmeter Ammeter AC DC Volt Ohmmeter Tester Meter Auto Range

$9.95



Digital Multimeter Tester AC DC Volt Ohm Amp Clamp Meter Auto Range LCD Handheld picture

Digital Multimeter Tester AC DC Volt Ohm Amp Clamp Meter Auto Range LCD Handheld

$10.95



Digital Multimeter Voltmeter BSIDE AC DC Ammeter Ohmmeter Volt Meter Tester Ohm picture

Digital Multimeter Voltmeter BSIDE AC DC Ammeter Ohmmeter Volt Meter Tester Ohm

$19.98



5/10Pcs DC 100V 10A Digital Voltmeter Ammeter LED Amp Volt Meter Current Gauge picture

5/10Pcs DC 100V 10A Digital Voltmeter Ammeter LED Amp Volt Meter Current Gauge

$21.98



DC 50uA 1mA 20mA 30A 85C1 Class 2.5 Analog Amp Panel Meter Gauge Current Ammeter picture

DC 50uA 1mA 20mA 30A 85C1 Class 2.5 Analog Amp Panel Meter Gauge Current Ammeter

$83.28







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.