Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    345

    "Always on Top" tray menu option

    hiya guys,

    been playing with a custom menu from the tray icon, got 99% of it all sorted from looking through old posts, just stuck on one feature i'd like :P

    i would like an "Always on Top" option that is "unchecked" on first running the project (as it is set to normal and NOT always on top in the settings) but will change to "checked" when that menu option is selected, i know how to change the window state setting, i just dont know how do get that value, or how to change the checked/unchecked state of the menu command.

    As i can't see any option for getting the window state (Zorder) to compare it to another state, i was thinking that the way to go would be to switch the menu id state between checked and unchecked, and then setting the window Zorder relative to that result.

    or is there a way to manipulate the projects settings once it has been compiled ...... or am i making no sense what so ever to you guys !!!!

  2. #2
    Join Date
    Oct 2006
    Posts
    345
    i finally figured it out

    the problem i had was that all the examples were based on doing this from a menu bar and not a menu in the task tray, using the On_Menu scripting section, whereas from the tasktray icon this wont work.
    Here's what i did, hopefully it will be of some help to others if they are searching this.

    All the code went in the Global section,

    to control the check mark in the menu i added this just after the "function g_OnSystemTrayMenu(X, Y)" Line
    Code:
    state = Registry.GetValue(2, "Software\\Auto Desc", "OnTop", false);
    	if (state ~= "Yes") then
    	  On_Top = false
    	else
    	  On_Top = true
    end
    Then for the "tblMenu[2].Checked" property i put "On_Top" in the place of true/false ... [2] being my menu id

    then in the action to perform in the event of that menu option being selected, i put this..
    Code:
    current_state = Registry.GetValue(2, "Software\\Auto Desc", "OnTop", false);
    	if (current_state == "Yes") then
    	  Registry.SetValue(2, "Software\\Auto Desc", "OnTop", "No", REG_SZ);
    	  Window.SetOrder(Application.GetWndHandle(), HWND_NOTOPMOST);
    	else
    	  Registry.SetValue(2, "Software\\Auto Desc", "OnTop", "Yes", REG_SZ);
    	  Window.SetOrder(Application.GetWndHandle(),  HWND_TOPMOST);
    	end

    works like a charm

  3. #3
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    I have considered doing something like that, thanks for sharing!

  4. #4
    Join Date
    Oct 2006
    Posts
    345
    your welcome, glad it's of some help

  5. #5
    Join Date
    Oct 2006
    Posts
    345
    :( i found a bug....

    the menu checked condition is remembered if you close your project while it is set to "always on top" however, the actual on top command isnt, so to ensure the menu is cleared on each run of your project, place this in the "On Preload" section of your project properties.

    Code:
     -- Reset on top marker --
     Registry.SetValue(2, "Software\\Auto Desc", "OnTop", "No", REG_SZ);
    it would be nice if it could remember the setting completely, but for my purpose it's not important

Similar Threads

  1. Article: Adding a Menu Bar System
    By Brett in forum AutoPlay Media Studio 7.5 Examples
    Replies: 5
    Last Post: 12-04-2006, 07:31 PM
  2. Creating a Tray Menu
    By d3m0n1x in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 04-29-2006, 08:48 PM
  3. Need help with tray menu
    By Roboblue in forum AutoPlay Media Studio 6.0
    Replies: 5
    Last Post: 04-02-2006, 04:19 PM
  4. More Menu Bar Examples
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 5
    Last Post: 02-28-2006, 08:58 AM
  5. TUTORIAL: Showing and Hiding Objects in AutoPlay Menu Studio 3.0
    By Support in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 10-10-2002, 02:39 PM

Posting Permissions

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