disabling controls

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

    #1

    disabling controls

    That is exactly what I am looking for. Just one thing,
    after I turn the cursor into a wait cursor, is there a
    way to disable all the controls (e.g buttons, textboxes)
    so that I can't click on anything, or do I have to
    disable each control individually. Again , thanks for
    the reply.
    [color=blue]
    >-----Original Message-----
    >Mike,
    >
    >Something along these lines:
    >-------------
    >Cursor = Cursors.WaitCur sor;
    >// ... do processing
    >Cursor = Cursors.Arrow;
    >-------------
    >
    >Is this what you were looking for?
    >
    >Regards,
    >Alex
    >
    >
    >"Mike" <mikebiros@hotm ail.com> wrote in message
    >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..[color=green]
    >> Currently, when my application needs to write/read to a
    >> database, there is a time lag. In that time lag, a[/color][/color]
    user[color=blue][color=green]
    >> can click the same button multiple times causing my app
    >> problems. I want to turn the mouse pointer arrow into[/color][/color]
    an[color=blue][color=green]
    >> hourglass and ignore mouse clicks until my app finishes
    >> working. Most commercial apps I've looked at do this.
    >> Is there an easy way to do this (ie. any built-in
    >> controls in VS.NET or classes in MSDN)? Any[/color][/color]
    suggestions[color=blue][color=green]
    >> and/or code samples would be greatly appreciated.[/color][/color]
    Thank[color=blue][color=green]
    >> you for the reply.
    >>
    >> Mike[/color]
    >
    >
    >.
    >[/color]
    ..


  • Chris Taylor

    #2
    Re: disabling controls

    Hi,

    You could disable the Form. I would recommend you do this in a try ...
    finally block.

    try
    {
    Cursor = Cursors.WaitCur sor;
    Enabled = false;

    // Processing here
    }
    finally
    {
    Enabled = true;
    Cursor = Cursors.Default ;
    }

    The sample assumes this code is in a member of the Form.

    Hope this helps

    Chris Taylor
    "Mike" <mikebiros@hotm ail.com> wrote in message
    news:5e2b01c377 5a$586ee350$a50 1280a@phx.gbl.. .[color=blue]
    > That is exactly what I am looking for. Just one thing,
    > after I turn the cursor into a wait cursor, is there a
    > way to disable all the controls (e.g buttons, textboxes)
    > so that I can't click on anything, or do I have to
    > disable each control individually. Again , thanks for
    > the reply.
    >[color=green]
    > >-----Original Message-----
    > >Mike,
    > >
    > >Something along these lines:
    > >-------------
    > >Cursor = Cursors.WaitCur sor;
    > >// ... do processing
    > >Cursor = Cursors.Arrow;
    > >-------------
    > >
    > >Is this what you were looking for?
    > >
    > >Regards,
    > >Alex
    > >
    > >
    > >"Mike" <mikebiros@hotm ail.com> wrote in message
    > >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..[color=darkred]
    > >> Currently, when my application needs to write/read to a
    > >> database, there is a time lag. In that time lag, a[/color][/color]
    > user[color=green][color=darkred]
    > >> can click the same button multiple times causing my app
    > >> problems. I want to turn the mouse pointer arrow into[/color][/color]
    > an[color=green][color=darkred]
    > >> hourglass and ignore mouse clicks until my app finishes
    > >> working. Most commercial apps I've looked at do this.
    > >> Is there an easy way to do this (ie. any built-in
    > >> controls in VS.NET or classes in MSDN)? Any[/color][/color]
    > suggestions[color=green][color=darkred]
    > >> and/or code samples would be greatly appreciated.[/color][/color]
    > Thank[color=green][color=darkred]
    > >> you for the reply.
    > >>
    > >> Mike[/color]
    > >
    > >
    > >.
    > >[/color]
    > .
    >
    >[/color]


    Comment

    • Mike

      #3
      Re: disabling controls

      I was thinking about doing this but I would prefer to
      disable the form without greying out the buttons and
      textboxes. Can I do this? Maybe some method can be
      called that will cause my app to ignore mouse clicks.
      Thanks again for the reply.
      [color=blue]
      >-----Original Message-----
      >Hi,
      >
      >You could disable the Form. I would recommend you do[/color]
      this in a try ...[color=blue]
      >finally block.
      >
      > try
      > {
      > Cursor = Cursors.WaitCur sor;
      > Enabled = false;
      >
      > // Processing here
      > }
      > finally
      > {
      > Enabled = true;
      > Cursor = Cursors.Default ;
      > }
      >
      >The sample assumes this code is in a member of the Form.
      >
      >Hope this helps
      >
      >Chris Taylor
      >"Mike" <mikebiros@hotm ail.com> wrote in message
      >news:5e2b01c37 75a$586ee350$a5 01280a@phx.gbl. ..[color=green]
      >> That is exactly what I am looking for. Just one thing,
      >> after I turn the cursor into a wait cursor, is there a
      >> way to disable all the controls (e.g buttons,[/color][/color]
      textboxes)[color=blue][color=green]
      >> so that I can't click on anything, or do I have to
      >> disable each control individually. Again , thanks for
      >> the reply.
      >>[color=darkred]
      >> >-----Original Message-----
      >> >Mike,
      >> >
      >> >Something along these lines:
      >> >-------------
      >> >Cursor = Cursors.WaitCur sor;
      >> >// ... do processing
      >> >Cursor = Cursors.Arrow;
      >> >-------------
      >> >
      >> >Is this what you were looking for?
      >> >
      >> >Regards,
      >> >Alex
      >> >
      >> >
      >> >"Mike" <mikebiros@hotm ail.com> wrote in message
      >> >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..
      >> >> Currently, when my application needs to write/read[/color][/color][/color]
      to a[color=blue][color=green][color=darkred]
      >> >> database, there is a time lag. In that time lag, a[/color]
      >> user[color=darkred]
      >> >> can click the same button multiple times causing my[/color][/color][/color]
      app[color=blue][color=green][color=darkred]
      >> >> problems. I want to turn the mouse pointer arrow[/color][/color][/color]
      into[color=blue][color=green]
      >> an[color=darkred]
      >> >> hourglass and ignore mouse clicks until my app[/color][/color][/color]
      finishes[color=blue][color=green][color=darkred]
      >> >> working. Most commercial apps I've looked at do[/color][/color][/color]
      this.[color=blue][color=green][color=darkred]
      >> >> Is there an easy way to do this (ie. any built-in
      >> >> controls in VS.NET or classes in MSDN)? Any[/color]
      >> suggestions[color=darkred]
      >> >> and/or code samples would be greatly appreciated.[/color]
      >> Thank[color=darkred]
      >> >> you for the reply.
      >> >>
      >> >> Mike
      >> >
      >> >
      >> >.
      >> >[/color]
      >> .
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • timtos

        #4
        Re: disabling controls

        If you want to, you can create your own custom button class.
        Doing all the drawing stuff yourself, you can tell the button to
        look like "this" when it is disabled and to look like "that" when
        it is enabled...

        Hope I understood you question right!

        Greetings,
        timtos.

        "Mike" <mikebiros@hotm ail.com> wrote in message news:087e01c377 67$711452c0$a40 1280a@phx.gbl.. .[color=blue]
        > I was thinking about doing this but I would prefer to
        > disable the form without greying out the buttons and
        > textboxes. Can I do this? Maybe some method can be
        > called that will cause my app to ignore mouse clicks.
        > Thanks again for the reply.
        >[color=green]
        > >-----Original Message-----
        > >Hi,
        > >
        > >You could disable the Form. I would recommend you do[/color]
        > this in a try ...[color=green]
        > >finally block.
        > >
        > > try
        > > {
        > > Cursor = Cursors.WaitCur sor;
        > > Enabled = false;
        > >
        > > // Processing here
        > > }
        > > finally
        > > {
        > > Enabled = true;
        > > Cursor = Cursors.Default ;
        > > }
        > >
        > >The sample assumes this code is in a member of the Form.
        > >
        > >Hope this helps
        > >
        > >Chris Taylor
        > >"Mike" <mikebiros@hotm ail.com> wrote in message
        > >news:5e2b01c37 75a$586ee350$a5 01280a@phx.gbl. ..[color=darkred]
        > >> That is exactly what I am looking for. Just one thing,
        > >> after I turn the cursor into a wait cursor, is there a
        > >> way to disable all the controls (e.g buttons,[/color][/color]
        > textboxes)[color=green][color=darkred]
        > >> so that I can't click on anything, or do I have to
        > >> disable each control individually. Again , thanks for
        > >> the reply.
        > >>
        > >> >-----Original Message-----
        > >> >Mike,
        > >> >
        > >> >Something along these lines:
        > >> >-------------
        > >> >Cursor = Cursors.WaitCur sor;
        > >> >// ... do processing
        > >> >Cursor = Cursors.Arrow;
        > >> >-------------
        > >> >
        > >> >Is this what you were looking for?
        > >> >
        > >> >Regards,
        > >> >Alex
        > >> >
        > >> >
        > >> >"Mike" <mikebiros@hotm ail.com> wrote in message
        > >> >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..
        > >> >> Currently, when my application needs to write/read[/color][/color]
        > to a[color=green][color=darkred]
        > >> >> database, there is a time lag. In that time lag, a
        > >> user
        > >> >> can click the same button multiple times causing my[/color][/color]
        > app[color=green][color=darkred]
        > >> >> problems. I want to turn the mouse pointer arrow[/color][/color]
        > into[color=green][color=darkred]
        > >> an
        > >> >> hourglass and ignore mouse clicks until my app[/color][/color]
        > finishes[color=green][color=darkred]
        > >> >> working. Most commercial apps I've looked at do[/color][/color]
        > this.[color=green][color=darkred]
        > >> >> Is there an easy way to do this (ie. any built-in
        > >> >> controls in VS.NET or classes in MSDN)? Any
        > >> suggestions
        > >> >> and/or code samples would be greatly appreciated.
        > >> Thank
        > >> >> you for the reply.
        > >> >>
        > >> >> Mike
        > >> >
        > >> >
        > >> >.
        > >> >
        > >> .
        > >>
        > >>[/color]
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        Working...