Beijer Electronics (formerly QSI Corporation)
http://www.qsiforums.com/

[Solved] Menubar Hidden
http://www.qsiforums.com/viewtopic.php?f=6&t=4783
Page 1 of 1

Author:  UnknownBytes [ Wed Apr 23, 2014 8:13 am ]
Post subject:  [Solved] Menubar Hidden

Hello,

After a recent library update my menu is no longer working properly. The menu exists, but does not display. For example, selecting the key to bring up the menu and nothing happens, but I can still use the arrows to navigate the menu and use enter to select the option. Basically, the menu is opening and is usable, but nothing is being displayed to the user. If you know the menu orientation you can navigate it as it's just invisible.

Object: MLSoftKey
menudata: (Opt1,,,0;Opt2,,,1;Opt3,,,2;Opt4,,,3;)

This object is used on a MLSoftkeyBar.

One thing I'd like to note is that the version prior to the update was able to set 8 different menudata (i.e. menudata1, menudata2, etc.) and the only change required was to remove all 8 and just use menudata. I don't see how this would affect the visibility as everything else is the same and even matches the example below.

Trying to solve this issue I was reading through the following thread: softkeyV2 and menus

While my object above worked previously, I noticed the example in the thread had the hot char's in use so I added one for each of my options, but that didn't fix it.

I've also tried using handleKeyPress() to disable the objects in the window to see if the menu was hiding behind it. Disabling the objects made no difference, the menu remains invisible.

I'm unsure where to go from here. The menu exists and is functional, but is invisible. Is there anyway to use handleKeyPress() to force the menu to display?

Author:  Jeremy [ Wed Apr 23, 2014 10:05 am ]
Post subject:  Re: Menubar Hidden

Can you provide more details about the library update?

What version of Qlarity Foundry are you using? Did you receive a new version of Basic.qlib? Where did you get that new version?

Author:  UnknownBytes [ Thu Apr 24, 2014 4:08 am ]
Post subject:  Re: Menubar Hidden

Jeremy wrote:
Can you provide more details about the library update?

What version of Qlarity Foundry are you using? Did you receive a new version of Basic.qlib? Where did you get that new version?


I apologize about the lack of information in my original post.

The previous version of Qlarity Foundry was version 2.51 and the upgrade was to version 2.63. The main reason for the upgrade was for a newer version of Basic.qlib. I needed CheckBoxV2 and the old version of Basic.qlib that was being used didn't have this object. I obtained the new version of Qlarity Foundry from the Beijer website. The new Basic.qlib came with the upgraded Qlarity Foundry.

Something I also forgot to include in the original post is I'm using a QTERM-G55 terminal.

Author:  Jeremy [ Thu Apr 24, 2014 7:17 am ]
Post subject:  Re: Menubar Hidden

I am wondering if it has something to do with your project itself. At its basic level the menus still work with Qlarity 2.63. In fact I went and created a new project and used the menu you provided in a new project and I can see it just fine. The menu will work quite hard to ensure that it appears above all other objects.

If you can start a new project and see the menu that means that there is something unique about your project.

You can see a lot of detail about where the menu is and its visibility status with some code like this:
Code:
func handleKeyDown()
    dim arr[1] as objref
    init arr := [g_55_popupmenu_1]
    _print("Key Press:")
    _print("    Menu Enabled: " + str(GetEnableInfo(g_55_popupmenu_1, GET_ENABLED)) + "              (" + str(GetEnableInfo(G_55_PopupMenu_1, GET_ZENABLED)) + ")")
    _print("    Menu Pos: " + str(GetPosInfo(g_55_popupmenu_1, GET_XGLOBAL)) + ", " + str(GetPosInfo(g_55_popupmenu_1, GET_YGLOBAL)) + " - " + str(GetPosInfo(g_55_popupmenu_1, GET_Width)) + "x" + str(GetPosInfo(g_55_popupmenu_1, GET_Height)))
    _print("    Menu Parent: " + str(GetContainer(g_55_popupmenu_1)))
    _print("    Menu ZIndex: " + str(find(GetChildren(GetContainer(g_55_popupmenu_1)), 0, -1, arr)))
    _print("    Menu Siblings: " + str(GetChildren(GetContainer(g_55_popupmenu_1))))
endfunc

func handleKeyRelease()
    dim arr[1] as objref
    init arr := [g_55_popupmenu_1]
    _print("Key Release:")
    _print("    Menu Enabled: " + str(GetEnableInfo(g_55_popupmenu_1, GET_ENABLED)) + "              (" + str(GetEnableInfo(G_55_PopupMenu_1, GET_ZENABLED)) + ")")
    _print("    Menu Pos: " + str(GetPosInfo(g_55_popupmenu_1, GET_XGLOBAL)) + ", " + str(GetPosInfo(g_55_popupmenu_1, GET_YGLOBAL)) + " - " + str(GetPosInfo(g_55_popupmenu_1, GET_Width)) + "x" + str(GetPosInfo(g_55_popupmenu_1, GET_Height)))
    _print("    Menu Parent: " + str(GetContainer(g_55_popupmenu_1)))
    _print("    Menu ZIndex: " + str(find(GetChildren(GetContainer(g_55_popupmenu_1)), 0, -1, arr)))
    _print("    Menu Siblings: " + str(GetChildren(GetContainer(g_55_popupmenu_1))))
endfunc


Try running your program in SimulationView and seeing what that prints out. I see the following:
Key Press:
Menu Enabled: true (true)
Menu Pos: 1, 377 - 53x78
Menu Parent: default
Menu ZIndex: 14
Menu Siblings: [_keyfocusdisplay, button_1, screen_1, softkeybar_1, exceptiondisplay, screensaver, sk_testitem, g_55_popupmenu_8, g_55_popupmenu_7, g_55_popupmenu_6, g_55_popupmenu_5, g_55_popupmenu_4, g_55_popupmenu_3, g_55_popupmenu_2, g_55_popupmenu_1, _ss_display, _object_skbar, _eb_symbols_skey, _eb_smaller_skey, _eb_pageup_skey, _eb_pagedown_skey, _eb_nextline_skey, _eb_larger_skey, _eb_insert_skey, _eb_home_skey, _eb_escape_skey, _eb_enter_skey, _eb_end_skey, _eb_clear_skey, _eb_backspace_skey]
Key Release:
Menu Enabled: true (true)
Menu Pos: 1, 377 - 53x78
Menu Parent: default
Menu ZIndex: 1
Menu Siblings: [_keyfocusdisplay, g_55_popupmenu_1, button_1, screen_1, softkeybar_1, exceptiondisplay, screensaver, sk_testitem, g_55_popupmenu_8, g_55_popupmenu_7, g_55_popupmenu_6, g_55_popupmenu_5, g_55_popupmenu_4, g_55_popupmenu_3, g_55_popupmenu_2, _ss_display, _object_skbar, _eb_symbols_skey, _eb_smaller_skey, _eb_pageup_skey, _eb_pagedown_skey, _eb_nextline_skey, _eb_larger_skey, _eb_insert_skey, _eb_home_skey, _eb_escape_skey, _eb_enter_skey, _eb_end_skey, _eb_clear_skey, _eb_backspace_skey]

Author:  UnknownBytes [ Thu Apr 24, 2014 10:22 am ]
Post subject:  Re: Menubar Hidden

You are correct, it is unique to the project. Starting a new project I can get the menu to show up.

I believe I know why it's being hidden now. Using your method to get the extra information I get the following:

Key Press:
Menu Enabled: true (true)
Menu Pos: 127, 242 - 63x76
Menu Parent: default
Menu ZIndex: 294
Key Release:
Menu Enabled: true (true)
Menu Pos: 127, 242 - 63x76
Menu Parent: default
Menu ZIndex: 1

The MLSoftkeyBar is on the bottom of the screen. Position 127, 242 is the pixel directly below the left edge of the 3rd button. I believe the menu is opening underneath the bar which in turn means the menu is being opened off the screen.

On the new project, it opens up at 127, 135 which is a pixel close to the center of the screen which allows the menu to open above the bar.

Is there a setting to direct the location of the menu? I don't see a place to specify whether the menu opens below or above the bar.

Author:  Jeremy [ Thu Apr 24, 2014 12:36 pm ]
Post subject:  Re: Menubar Hidden

The menu is supposed to dynamically adjust based on the location of the associated soft key (so if you put the soft key bar on top of the screen -- which you might do for a touch screen display, the menu will open down).

I have no idea why it would be opening below the soft key. There is a check in the code that tries to open the menu above the soft key, but if the bottom of the menu overlaps the soft key it moves it to the bottom. The only way I could see that come into play in your scenario is if your soft key bar were > 160 pixels tall.

As I cannot see what is going on in your project, I can tell you how I would debug it in mine. I would open up the Libraries\SoftKeyV2 entry and put a breakpoint in the DisplayPopupMenu function and follow the code around to see what is going on there. The key decision points that I can see would be the call G_55_PopupMenu_1.ShowMenu(x, y, HJustify_Left, VJustify_Bottom), as well as when you leave the SoftKey.DisplayPopupMenu function you will fall back into the SoftKeyBar.DisplayPopupMenu function and there is this line of code that may be causing your problem:

if (G_55_PopupMenu_1.ypos + G_55_PopupMenu_1.height) > (yPos+1) then

Author:  UnknownBytes [ Fri Apr 25, 2014 5:00 am ]
Post subject:  Re: Menubar Hidden

Your information was really helpful. The issue was in the following line you mentioned:

if (G_55_PopupMenu_1.ypos + G_55_PopupMenu_1.height) > (yPos+1) then

My Instance
G_55_PopupMenu_1.ypos: 136
G_55_PopupMenu_1.height: 76
yPos: 200

The problem was using yPos. In my project very top parent screen has a ypos of 12 as the first 12 pixels are being used for a statusbar. The child screens have a ypos of 0, but in essence are 12 as well through the top parent. From the screen drawing the menu yPos was grabbing 200 when the real position was 211. So the calculation above using yPos was always hitting as over.

I modified the code as follows:

if (G_55_PopupMenu_1.ypos + G_55_PopupMenu_1.height) > (y+1) then

y is already being calculated a few steps above as the global position so it is using the proper 211 value. This lets the intended use of the function work correctly in that other menus may open below if out of space.

I believe the DisplayPopupMenu function in SoftKeyBarV2 should get looked into. It calls the DisplayPopupMenu in SoftKeyV2 by using the global position of x and y. So here we have the menu location and size being calculated based on the global position. It is then later compared to the local position of y (yPos) when determining to display above or below. This creates inconsistencies when global screen doesn't match the local screen. I believe the function should look at the information all globally or all locally.

The final solution for others who may come across this issue is I modified my version to look at the information all globally as per above. I will mark the topic as solved for others to know a solution is found within.

Thank you for your help and giving me the direction of how SoftKeyBarv2 and SoftKeyV2 worked.

Author:  Jeremy [ Fri Apr 25, 2014 7:52 am ]
Post subject:  Re: [Solved] Menubar Hidden

Thank you for your help in looking at that. I admit that soft key menus are an underused feature. You may be the only one who is using one with a menu on a screen that isn't full screen.

I added a bug to look at that issue and

Author:  UnknownBytes [ Fri Apr 25, 2014 8:06 am ]
Post subject:  Re: [Solved] Menubar Hidden

The software has quite a few screens, but only one has a menu. So it was also a rare need on our part. All the other screens use basic soft keys. I figured menus were rare as there was only 2 topics I could find on the subject.

Thank you for adding the bug.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/