IonicWind Software

IWBasic => General Questions => Topic started by: Andy on October 10, 2011, 06:01:06 AM

Title: Menu Item not invoking a browser command
Post by: Andy on October 10, 2011, 06:01:06 AM
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.

Title: Re: Menu Item not invoking a browser command
Post by: LarryMc on October 10, 2011, 07:24:34 AM
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
Title: Re: Menu Item not invoking a browser command
Post by: Andy on October 10, 2011, 08:31:07 AM
Thanks Larry,

Always a hero!

Knew it was me missing something.

Thanks again,
Andy.
:)