LB Booster
« Another flaky idea? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:46am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Another flaky idea?  (Read 217 times)
Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Another flaky idea?
« Thread started on: Sep 17th, 2016, 9:35pm »

Alyce wrote the following code to remove file and edit menus from a text window.
I am only responsible for the menu statement that turns the menu bar into column headings for a report that are always visible, regardless of scrolling.

Is this useful to anyone else?

r.m.

Code:
 menu #rpt, "      Category                             Cost               Date                          Description                                                         Period                           Remarks"     , "", [x]   
    Open "Diary Report by " + seq$ for text_fs as #rpt   
    
    hMain=hWnd(#rpt)
    hMainMenu=GetMenu(hMain)
    hMainEdit=GetSubMenu(hMainMenu,1)
    result=RemoveMenu(hMainMenu,hMainEdit)
    Call DrawMenuBar hWnd(#rpt)
    hMainEdit=GetSubMenu(hMainMenu,1)
    result=RemoveMenu(hMainMenu,hMainEdit)
    Call DrawMenuBar hWnd(#rpt)    
    return

Sub DrawMenuBar hWnd
    CallDLL #user32, "DrawMenuBar",_
    hWnd As ulong, r As boolean
    End Sub

Function GetSubMenu(hMenuBar,nPos)
    CallDLL #user32, "GetSubMenu",_
    hMenuBar As ulong, nPos As long,_
    GetSubMenu As ulong
    End Function
    
   Function GetMenu(hWnd)
    CallDLL #user32, "GetMenu",hWnd As ulong,_
    GetMenu As ulong
    End Function

    Function RemoveMenu(hMenu,hSubMenu)
    CallDLL #user32, "RemoveMenu", hMenu As ulong,_
    hSubMenu As ulong, _MF_BYCOMMAND As ulong,_
    RemoveMenu As boolean
    End Function 

 
User IP Logged

CryptoMan
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx Re: Another flaky idea?
« Reply #1 on: Sep 17th, 2016, 10:08pm »

But, File Edit is still appearing at the right end after Remarks.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Another flaky idea?
« Reply #2 on: Sep 17th, 2016, 11:38pm »

I don't know what you are doing, but I just ran my program again, and File and Edit do NOT appear anywhere on my menu bar.

r.m.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: Another flaky idea?
« Reply #3 on: Sep 18th, 2016, 08:02am »

I think the idea is ingenious and has many ways to be useful. I've cleaned up the code example a bit for (hopefully) easier testing.

Code:
NoMainWin
WindowWidth=800 : WindowHeight=600
menu #rpt, "Category                  Cost                  Date_
                  Description                  Period                  Remarks"
Open "Menu Report Headings " for text as #rpt   
#rpt "!TrapClose [quit]"
hMain=hWnd(#rpt)
hMainMenu=GetMenu(hMain)
hMainEdit=GetSubMenu(hMainMenu,1)
result=RemoveMenu(hMainMenu,hMainEdit)
Call DrawMenuBar hWnd(#rpt)
hMainEdit=GetSubMenu(hMainMenu,1)
result=RemoveMenu(hMainMenu,hMainEdit)
Call DrawMenuBar hWnd(#rpt)    
Wait

[quit]
close #rpt
end

Sub DrawMenuBar hWnd
    CallDLL #user32, "DrawMenuBar",_
    hWnd As ulong, r As boolean
End Sub

Function GetSubMenu(hMenuBar,nPos)
    CallDLL #user32, "GetSubMenu",_
    hMenuBar As ulong, nPos As long,_
    GetSubMenu As ulong
End Function
    
Function GetMenu(hWnd)
    CallDLL #user32, "GetMenu",hWnd As ulong,_
    GetMenu As ulong
End Function

Function RemoveMenu(hMenu,hSubMenu)
    CallDLL #user32, "RemoveMenu", hMenu As ulong,_
    hSubMenu As ulong, _MF_BYCOMMAND As ulong,_
    RemoveMenu As boolean
End Function
 
« Last Edit: Sep 19th, 2016, 06:03am by Jack Kelly » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Another flaky idea?
« Reply #4 on: Sep 18th, 2016, 09:31am »

on Sep 17th, 2016, 9:35pm, Alincon wrote:
Alyce wrote the following code to remove file and edit menus from a text window

If you want to remove all the menus (and the menu bar itself) then the method I showed before is easy. But if you want to selectively remove menus and retain the menu bar you can use Alyce's code.

Richard.

User IP Logged

CryptoMan
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx Re: Another flaky idea?
« Reply #5 on: Sep 19th, 2016, 1:15pm »

@Jack Kelly: I don't think you can put _ continuation character within quoted strings. Strangely enough this works in LBB but it doesn't work in LB.

I must have tested your code with LB instead of LBB. In LB File Edit keeps coming on the right but in LBB it is not coming. I don't know the reason for this difference.

However, _ in the middle of unclosed quotes is quite unorthodox.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls