Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Menu bar stays after being removed
Message
From
13/01/2022 06:31:02
 
 
To
12/01/2022 16:59:37
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
01683251
Message ID:
01683258
Views:
59
>Hi Tamar.
>
>Have you manually counted how many bars are left after the removal? Can you still see the full 12 or are there now only 11 as the code says? Given that you are printing the bar prompt and don't say it's wrong I doubt it's removing the wrong bar, but I thought I'd ask.
>
>Ian Simcock.

After the removal, despite CNTBAR() saying there are 11 bars, visually, there are still 12 bars. I did a screen grab of the menu before the removal and visually compared it to what's there after the screen bar and they're identical.

Thinking next step is to actually loop through after and print out (well, DEBUGOUT) what's there. Obviously, I can't use CNTBAR() to end the loop, so I'll do something with TRY-CATCH, looping to 99 or 999 or something.

Tamar


>
>>Got another weird one. I have a couple of forms that have code in Init to add a bar to a particular menu popup and code in Destroy to remove that bar. Some of the time (and I'm not sure exactly when that is and this morning, can't find any such cases), all works as expected. The bar is added when the form opens and goes away when it closes. More often, the bar is added when the form opens and doesn't go away when it closes.
>>
>>I've used the Event Tracker to make sure the form's Destroy event fires and added DEBUGOUTs to make sure I'm releasing the right bar and that, in fact, something is being removed. This code:
>>
>>
>>DEBUGOUT PROGRAM()
>>DEBUGOUT "  About to check for menu bar"
>>IF ThisForm.lnCnt2Bar > 0 AND CNTBAR('Print') >= ThisForm.lnCnt2Bar
>>   DEBUGOUT "   About to remove menu bar", ThisForm.lnCnt2Bar
>>   DEBUGOUT "   Bar prompt is", PRMBAR('Print', ThisForm.lnCnt2Bar)
>>   DEBUGOUT "   Print menu has", CNTBAR('Print'), ' bars before release bar'
>>   release bar ThisForm.lnCnt2Bar of print
>>   DEBUGOUT "   Print menu has", CNTBAR('Print'), ' bars after release bar'
>>ENDIF ThisForm.lnCnt2Bar > 0 AND CNTBAR('Print') >= ThisForm.lnCnt2Bar
>>
>>
>>produces this output in the Debug Output window:
>>
>>
>>FRMSALESORD.DESTROY
>>  About to check for menu bar
>>   About to remove menu bar         12
>>   Bar prompt is Default Print Options (SO)
>>   Print menu has         12  bars before release bar
>>   Print menu has         11  bars after release bar
>>
>>
>>But the bar is still on the menu.
>>
>>Anybody ever seen anything like this? Have any ideas? If menus had a Refresh method, I'd call it, but of course, they don't.
>>
>>Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform