October 30, 2025, 05:28:06 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Menu Item not invoking a browser command

Started by Andy, October 10, 2011, 06:01:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

I'm nearly finished now with the web browser project but I have a question:

I have added a menu

eg, BEGINMENU
   MENUTITLE "File"
   SEPARATOR
   MENUITEM "Exit",0,1000
etc ......

I want to add function such as "Print".
When you click on the print button the window for selecting the printer appears but I cannot get it to work from this menu?

                        CASE 8001
                              BROWSECMD *p.cont,@BROWSEPRINT

I know the CASE is selected because i have used Openconsole to prove it, but it just refuses the run the command BROWSECMD *p.cont,@BROWSEPRINT. It also applies to most window commands such as @swminimized etc.

is there something I need to put into this section?

      SELECT @CLASS

            CASE @IDMENUPICK
                  SELECT @MENUNUM

                                                CASE 8001
                                                  BROWSECMD *p.cont,@BROWSEPRINT

I'm probably missing the point, but can anyone help me in the right direction?

Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Here's the revised handler from the modified browser2 I posted previously.

The bottom line was you were using the wrong pointer.

SUB handler(),int
' @HITWINDOW points to BROWSERDATA.win
pointer p = @HITWINDOW - offsetof(BROWSERDATA,win)
settype p, BROWSERDATA
/*''''''''''''' Added Code''''''''''''''''''''''''''*/
pointer p2 = @HITWINDOW - offsetof(BROWSERDATA,cont)
settype p2, BROWSERDATA
/*''''''''''''''''''''''''''''''''''''''''''''''''''*/
WITH *p
SELECT @CLASS
CASE @IDCREATE
g_WindowCount++
BEGINMENU .win
MENUTITLE "&File"
MENUITEM "Print", 0, 8001
SEPARATOR
MENUITEM "Quit", 0, 1000
ENDMENU
/*''''''''''''' Added Code''''''''''''''''''''''''''*/
CASE @IDMENUPICK
SELECT @MENUNUM
CASE 8001
BROWSECMD (*p2.cont,@BROWSEPRINT)
endselect
/*''''''''''''''''''''''''''''''''''''''''''''''''''*/
CASE @IDDESTROY
g_WindowCount--

CASE @IDCLOSEWINDOW
CLOSEWINDOW (.urldlg) ' *p.urldlg)
CLOSEWINDOW (.cont)
CLOSEWINDOW (.win)
CLOSEWINDOW (.history)

CASE @IDSIZE
ResizeAll(.win, .cont, .urldlg,.history)

CASE @IDCONTROL
IF @NOTIFYCODE = 0 /* ignore any tooltip messages */
SELECT @CONTROLID
CASE idBack
BROWSECMD (.cont,@GOBACK)

CASE idForward
BROWSECMD (.cont,@GOFORWARD)

CASE idStop
BROWSECMD (.cont,@BROWSESTOP)

CASE idRefresh
BROWSECMD (.cont,@REFRESH)

CASE idHome
BROWSECMD (.cont,@GOHOME)

CASE idSearch
BROWSECMD (.cont,@BROWSESEARCH)

CASE idPrint
BROWSECMD (.cont,@BROWSEPRINT)

CASE idSave
IDispatch browser = GETBROWSERINTERFACE(.cont)
browser.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT)
browser->Release()

case idHistory
LoadHistory(.history)
history_visible=1
ResizeAll(.win, .cont, .urldlg,.history)
ENDSELECT
ENDIF
ENDSELECT
ENDWITH
RETURN 0
ENDSUB


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks Larry,

Always a hero!

Knew it was me missing something.

Thanks again,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.