Results 1 to 9 of 9

Thread: MenuItem.DefaultItem -> cant set to flase once set to true???

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    MenuItem.DefaultItem -> cant set to flase once set to true???

    I have a menu item which has a few sub-menu items. I've set one of the sub menu item's DefaultItem to true. I tried setting it to false at run time, but it still looks bold... why is it like this?

    if you dont understand, I have something like this

    File
    ----New
    ---------Blank (.DefaultItem = true)
    ---------From Tempalate
    ---------Custom

    once the user clicks on any item in the New menu, I try to set the DefaultItem property of all menu items to false, and set the DefaultItem property of the clicked menu to true. But for some it's not making any changes
    why is this happening?


    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    bump
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    bump
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    and a 3rd bump
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Instead of setting it to false try setting another menuitem to true. Maybe one has to be default and thus it wont let you change to false but will automatically change to false if another is set to true kind og like a group of radio buttons. Just a guess.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Edneeis
    Instead of setting it to false try setting another menuitem to true. Maybe one has to be default and thus it wont let you change to false but will automatically change to false if another is set to true kind og like a group of radio buttons. Just a guess.
    Edneeis? you think MrPolite already hasnt thought of that ? eeh
    I've tried setting all menu's defaultItem to false then another's to true. I've tried the reverse order too, setting the new menu's to true and the rest to false. doesnt seem to work
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well I tried.

  8. #8

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Edneeis
    Well I tried.
    you tried!? no excuses!
    hehe sorry, just kidding...

    umm someone in gotdotnet said that he had the same problem but fixed it by toggling the visible property of the menu items. Seems to be a bug in the framework.....

    I just cant believe how MS could write the framework with these obvious bugs. Those idiots probably knew about a bug as obvious as this one... I'm gonno try this visible thingie, hope it's gonno work
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    no need for code, but what the heck
    VB Code:
    1. Private Sub mnuiFlip_SubMenu_Click_ToggleDefaultItem(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuiFlipBoth.Click, mnuiFlipH.Click, mnuiFlipV.Click
    2.         Dim menuI, clickedMenu As MenuItem
    3.         clickedMenu = DirectCast(sender, MenuItem)
    4.         For Each menuI In mnuiFlip.MenuItems
    5.             menuI.DefaultItem = False
    6.             ' A bug in .NET framework requires to toggle the visible property
    7.             ' this is because we are changing the defaultItem property
    8.             menuI.Visible = False
    9.             menuI.Visible = True
    10.         Next
    11.         clickedMenu.DefaultItem = True
    12.     End Sub

    beautiful sub name hehe seems to work fine
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width