[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-bugs
Subject:    [haiku-bugs] Re: [Haiku] #18648: BOptionPopUp sets value even if not available
From:       "Haiku" <trac () haiku-os ! org>
Date:       2023-10-31 7:59:50
Message-ID: 061.cc47e74dc82e08708c51e55f85079712 () haiku-os ! org
[Download RAW message or body]

--==============58473564000407832=MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

#18648: BOptionPopUp sets value even if not available
---------------------------------+-------------------------
  Reporter:  jackburton          |      Owner:  nobody
      Type:  bug                 |     Status:  new
  Priority:  normal              |  Milestone:  Unscheduled
 Component:  Kits/Interface Kit  |    Version:  R1/beta4
Resolution:                      |   Keywords:
Blocked By:                      |   Blocking:
  Platform:  All                 |
---------------------------------+-------------------------
Comment (by jackburton):

 The proposed change is

 {{{
 void
 BOptionPopUp::SetValue(int32 value)
 {
 -       BControl::SetValue(value);
         BMenu* menu = fMenuField->Menu();
         if (menu == NULL)
                 return;

         int32 numItems = menu->CountItems();
         for (int32 i = 0; i < numItems; i++) {
                 BMenuItem* item = menu->ItemAt(i);
                 if (item && item->Message()) {
                         int32 itemValue;
                         item->Message()->FindInt32("be:value",
 &itemValue);
                         if (itemValue == value) {
 +                               BControl::SetValue(value);
                                 item->SetMarked(true);
                                 break;
                         }
                 }
         }
 }
 }}}
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/18648#comment:2>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.
--==============58473564000407832==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic