Textbox Controls, PopUpMenu, and Almost-Solution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Kochem

    Textbox Controls, PopUpMenu, and Almost-Solution

    By default, right-clicking the TextBox control launches a standard "edit"
    pop-up menu.
    Microsoft provides a work-around for the case where you want to launch a
    different pop-up menu;


    80/support/kb/articles/Q224/3/02.ASP&NoWebCon tent=1

    The work-aound works, but has a near-fatal (in my opinion) flaw, which
    Microsoft warns you about; if you end execution of the program without
    having de-activated the workaround (via code in an Unload event) the VB IDE
    itself crashes.

    This means;

    - When executing your program (in the IDE) you can't use the "Stop/End"
    button or VB will crash

    and worse

    - If you encounter a bug in your program, many times (at least for me)
    you're going to get crashed out of VB because the "End" button would crash
    you directly, and if you go into "Debug" mode, unless the problem is easy to
    fix you're ultimately going to do an End (and crash)

    Does anyone know of a way to 'work-around this work-around" ?

    Thanks a lot,

    Bob Kochem


  • Raoul Watson

    #2
    Re: Textbox Controls, PopUpMenu, and Almost-Solution


    "Bob Kochem" <r.kochem@world net.att.net> wrote in message
    news:8CcRa.492$ 7O.94@nwrdny01. gnilink.net...[color=blue]
    > By default, right-clicking the TextBox control launches a standard "edit"
    > pop-up menu.
    > Microsoft provides a work-around for the case where you want to launch a
    > different pop-up menu;
    >
    >[/color]
    http://support.microsoft.com/default...microsoft.com:[color=blue]
    > 80/support/kb/articles/Q224/3/02.ASP&NoWebCon tent=1
    >
    > The work-aound works, but has a near-fatal (in my opinion) flaw, which
    > Microsoft warns you about; if you end execution of the program without
    > having de-activated the workaround (via code in an Unload event) the VB[/color]
    IDE[color=blue]
    > itself crashes.
    >
    > This means;
    >
    > - When executing your program (in the IDE) you can't use the "Stop/End"
    > button or VB will crash
    >
    > and worse
    >
    > - If you encounter a bug in your program, many times (at least for me)
    > you're going to get crashed out of VB because the "End" button would crash
    > you directly, and if you go into "Debug" mode, unless the problem is easy[/color]
    to[color=blue]
    > fix you're ultimately going to do an End (and crash)
    >
    > Does anyone know of a way to 'work-around this work-around" ?
    >
    > Thanks a lot,
    >
    > Bob Kochem
    >[/color]

    Bob.. to be honest I don't understand why you need to take that route.

    You can have whatever menu you want on a right mouse click.

    This is what I do:

    I create my own "edit" or whatever menu I want to show up on a right mouse
    click. I create this regularly on the menu bar but just make it "invisible"
    or leave it visible if you want a duplicate menu on edit or right-mouse.

    In my Text_MouseDown event, I detect the right mouse, if so, I display the
    menu, like so:

    Private Sub TextBox1_MouseD own(Button As Integer, Shift As Integer, x As
    Single, Y As Single)
    If Button = vbRightButton Then
    PopupMenu mnuEdit
    End If
    End Sub

    Am I missing something?


    Comment

    • Bob Butler

      #3
      Re: Textbox Controls, PopUpMenu, and Almost-Solution

      "Bob Kochem" <r.kochem@world net.att.net> wrote in message
      news:8CcRa.492$ 7O.94@nwrdny01. gnilink.net[color=blue]
      > By default, right-clicking the TextBox control launches a standard
      > "edit" pop-up menu.
      > Microsoft provides a work-around for the case where you want to
      > launch a different pop-up menu;[/color]
      <cut>

      go to http://groups.google.com and search for
      VB context menu releasecapture
      that will get you sample code for killing the default context menu without
      major side effects
      [color=blue]
      > This means;
      >
      > - When executing your program (in the IDE) you can't use the
      > "Stop/End" button or VB will crash[/color]

      That's good; you should never be using that anyway. It's similar to the VB
      END statement in that it doesn't allow normal cleanup of all objects. If
      you need to stop an app in the IDE use the "set next statement" and other
      options to walk through the code to a clean exit point and/or call cleanup
      routiens manually form the immediate window.
      [color=blue]
      > and worse
      >
      > - If you encounter a bug in your program, many times (at least for me)
      > you're going to get crashed out of VB because the "End" button would
      > crash you directly, and if you go into "Debug" mode, unless the
      > problem is easy to fix you're ultimately going to do an End (and
      > crash)
      >
      > Does anyone know of a way to 'work-around this work-around" ?[/color]

      With or without the options for dealing with the context menu issues don't
      ever use END or the STOP button

      Comment

      • Raoul Watson

        #4
        Re: Textbox Controls, PopUpMenu, and Almost-Solution


        "Bob Kochem" <r.kochem@world net.att.net> wrote in message
        news:vCoRa.1541 $0F4.56@nwrdny0 2.gnilink.net.. .
        [color=blue]
        > What you are describing works for just about anything *except* TextBox
        > controls. When you right-click a text-box control, VB enforces that a
        > standard 'edit' PopUp menu designed by them (not selected by you) gets
        > displayed.
        >[/color]

        I see what you mean.. the first click the VB default shows up, the second
        click, your menu.

        I use this method all the time and it works like a charm. Then again, I
        always use a RichTextBox.


        Comment

        Working...