Link to home
Start Free TrialLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

oracle forms window title- set title color based on instances

Oracle database function-  window title- set title color based on instances

 marked title is derived like below


   set_window_property
    ( forms_mdi_window
     ,title
     ,pkg_application_standards.func_get_mdi_window_title(:global.g_div_no));

pkg_application_stadards.func_get_mdi_window_title(:global.g_div_no) gives that marked title

  SELECT name
  INTO   v_name
  FROM   v$database;

function func_get_mdi_window_title ( p_div_no in varchar2 )
      return varchar2 is

      v_title    varchar2(100);
      v_db_name  varchar2(100);
      v_instance varchar2(100);
      begin

         select global_name into v_db_name
            from global_name;

         if v_db_name = 'DEV.SITE.COM' then
            v_instance := 'Dev'; 
         elsif v_db_name = 'TEST.SITE.COM' then
            v_instance := 'Test'; 
         elsif v_db_name = 'PROD.SITE.COM' then
            v_instance := 'Production';
         elsif v_db_name = '2.SITE.COM' then
            v_instance := 'Prod2';
	     elsif v_db_name = 'TEST2.SITE.COM' then
            v_instance := 'Test2';
         elsif v_db_name = 'DEV2.SITE.COM' then
            v_instance := 'Dev2';
         elsif v_db_name = 'GVN.SITE.COM' then
            v_instance := 'GVN';
         elsif v_db_name = 'GVN2.SITE.COM' then
            v_instance := 'Gvn2';
         elsif v_db_name = 'GVN3.SITE.COM' then
            v_instance := 'Gvn3';
         end if;
         if nvl(v_title,'x')='x' then
            v_title := 'Div '||p_div_no||'- '||v_instance||' App System';
         end if;
         
        return(v_title);
      exception when others then
         v_title := 'Div '||p_div_no||'-App System';
         return(v_title);
      end func_get_mdi_window_title;

Open in new window


Added function here


Based on the v_name (value) I have to set title color.
How can I accomplish that?
Help appreciated.
Avatar of Arana (G.P.)
Arana (G.P.)

I believe you can only change those settings in a PER Instance basis, the ability to override the core application color schemes at the responsibility level would only work when closing the application down and logging in under the different responsibility it has been set for. I dont think changing it at runtime during user interaction is possible.

Maybe you can try using an empty title and using Frame Title colors instead? (with Visual Attributes)
Please tell us which version of Oracle Forms you have.  I'm not sure that any version of Oracle Forms allows us to change the color of the title bar in the window.  But that is mostly based on my extensive experience with Forms6.  I have some experience with Forms10, but have not worked with Forms11 or later.
Avatar of anumoses

ASKER

Forms 11. I have a;so attached a package code where we get the title using a function. Can it be handled there? of how about putting a frame around the Mai Menu? Is that possible?
Yes, getting or changing the window title is supported in Oracle Forms but I've never seen the ability to change the color of the main window title bar in Oracle Forms.  Maybe that is new and supported in Forms11?  If not, you may have to settle for just changing the text in the title bar.
I don't have much experience in forms, but regarding the color changing I have read extensibly about it because I wanted to do the same thing (in forms 6) there is no property to be changed in any of the versions that allows to change window title color at runtime, you can however , change the background color of the form and objects in it, or use frames, the frame title color CAN be changed,  , you could try to maximize the form and hide the real title bar, and use an object to simulate the title bar, but if you have more than one child window then its no use.
Thanks for the info. Can you give me a sample form or the frame and how to change title color of the frame to be changed? This i a good suggestion.
@arana

This is what I did now. Three are three windows placed. The main window is not being used. Is there a way to set the window color based on the instances on the fly?
just create a frame with no title, and place a text item in its place , create a visual attribute with your desired settings,
and assign the attribute to item using set_item_property

sorry I cannot give you the form sample, its been like 7 years since last time I used forms. I am surprised I even remember some things like above lol
SET_CANVAS_PROPERTY('YOURCANVAS', BACKGROUND_COLOR, 'r189g230b196');
Thanks  dear
BEGIN
  SELECT name 
  INTO   v_name
  FROM   v$database;
END;

      If v_name = 'DEVDS' then--TESTDS
       
        SET_WINDOW_PROPERTY ('EVENTS', background_color, 'r189g230b196');
        SET_WINDOW_PROPERTY ('EVENTS', foreground_color, 'r189g230b196');
 
        SET_WINDOW_PROPERTY ('TOPTEN', background_color, 'r189g230b196');
        SET_WINDOW_PROPERTY ('TOPTEN', foreground_color, 'r189g230b196');
 
       SET_WINDOW_PROPERTY ('NAVIGATOR', background_color, 'r189g230b196');
       SET_WINDOW_PROPERTY ('NAVIGATOR', foreground_color, 'r189g230b196');
       
      End if;

Open in new window


In the form window property if I change background color to dark green it works but on the fly this code does not work. Any idea?
Its working now. But wanted a color code for dark green. The one you gave is light. Could not get one for dark green. How can I find the code for dark green?
oh I just typed whatever, not my intention to select any specific color, just wanted to show you as an example.

hmm dark green, well format is RxxxGxxxBxxx so dark green would probably be: r000g127b000
maybe you can select it by name same as you have in your form window property (not sure if it works, dont have a way to test it now)
try this:
('NAVIGATOR', background_color, 'Green');
or
('NAVIGATOR', background_color, 'DarkGreen');
Is there a way set item property for the title font to get into red or green color?
title of the window? NO
If the title is coming through a package function. The return value is what is the title of the window. So this cannot be changed in the package also? for the return value to be of the color we want?
ASKER CERTIFIED SOLUTION
Avatar of flow01
flow01
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The trick that I always use for picking a color and getting the correct RGB values is to go to windows.  When you try to set the background color, you can pick a custom color off the chart.  If you pick the color you want, it will give you the RGB values.  It appears in Windows 10 that you need to expand the advanced settings in custom color, but it still gives it to you.  You can also plug in the numbers and it will give you the color.
Thanks for all the help from experts. We are changing env file to have different colors.
Thanks again.