Print Page | Close Window

Value changed of combo box

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10026
Printed Date: 07 November 2025 at 7:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Value changed of combo box
Posted By: torbenjc
Subject: Value changed of combo box
Date Posted: 01 April 2008 at 8:42am
Hi,
 
how to catch that the value has been changed of a combo box in commandbar?
 
If it is the ControlNotify which codes to look for?
 
Because of problems with timer ActiveX we have set the update period to 24 hours, so that event won't work!
 
Regards,
Torben



Replies:
Posted By: Aaron
Date Posted: 01 April 2008 at 9:29am
Hi,
 
You can use the CommandBars UpdateEvent.
 
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.Id
        Case ....
            Do something...
    End Select
End Sub
 
This event fires when something is clicked, expanded, collapsed (you name it) with CommandBars.
 
If you want no automatic updates set: Commandbars.Options.UpdatePeriod = 0
 


Posted By: torbenjc
Date Posted: 07 April 2008 at 7:39am
Hi,
the update don't work for me! Only fires when the control is added, not when its value is changed.
Have added messags to ControlNotify and found the following for Code:
Toglebox close/leave: 8
Text leave: 512
 
But now I'm having problem setting combobox control values from within this code using Listindex.


Posted By: Aaron
Date Posted: 07 April 2008 at 10:05am
Hi,
 
And again you can use the Update event.
 
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.Id 
        Case <Your ID for the combobox comes here>
            msgbox Control.ListIndex
    End Select
End Sub
 
 


Posted By: torbenjc
Date Posted: 08 April 2008 at 2:14am

Hi,
CodeJock version 11.1.3 and the following (simplified) source written in OpenEdge, that I can't get to work.
When I run the GetSetQuickFilter procedure directly it works,n if I change the QMATCH edit field it works, but when I run it from the ControlNotify on value changed of 'QFIELD' it don't work :-(

/* Create of controls */
chQFilterItem = chQFilterBar:Controls:Add({&xtpControlComboBox}, add-id("QFIELD":U, "TOOL":U), "Field to filter on":T40).
chQFilterItem:WIDTH = 150.
CREATE bmopt.
ASSIGN
   bmopt.cAction = "QFIELD":U
   bmopt.main-type = "QFILTER":U
   bmopt.enable-when-clear = TRUE
   bmopt.chCodeJock = chQFilterItem
   bmopt.iCodeJockCreate = bm-option-icjseq
   bm-option-icjseq = bm-option-icjseq + 1.
FOR EACH ttBrwFld NO-LOCK WHERE ttBrwFld.cBrwID = ttBrw.cBrwID AND ttBrwFld.lInQuickFilter BY ttBrwFld.iSeq:
   chQFilterItem:AddItem(ttBrwFld.cFilterLabel).
END.
chQFilterItem:Listindex = 1.

chQFilterItem = chQFilterBar:Controls:Add({&xtpControlComboBox}, add-id("QOPER":U, "TOOL":U), "Filter operator":T40).
chQFilterItem:WIDTH = 150.
CREATE bmopt.
ASSIGN
   bmopt.cAction = "QOPER":U
   bmopt.main-type = "QFILTER":U
   bmopt.enable-when-clear = TRUE
   bmopt.chCodeJock = chQFilterItem
   bmopt.iCodeJockCreate = bm-option-icjseq
   bm-option-icjseq = bm-option-icjseq + 1.
chQFilterItem:AddItem("Includes":T25).
chQFilterItem:AddItem("Begins":T25).
chQFilterItem:AddItem("Greater than":T25).
chQFilterItem:AddItem("Greater than or equal":T25).
chQFilterItem:AddItem("Less than":T25).
chQFilterItem:AddItem("Less than or equal":T25).
chQFilterItem:AddItem("Equal to":T25).
chQFilterItem:AddItem("Not equal to":T25).
chQFilterItem:Listindex = 1.

chQFilterItem = chQFilterBar:Controls:Add({&xtpControlEdit}, add-id("QMATCH":U, "TOOL":U), "Filter match information":T40).
chQFilterItem:WIDTH = 150.
CREATE bmopt.
ASSIGN
   bmopt.cAction = "QMATCH":U
   bmopt.main-type = "QFILTER":U
   bmopt.enable-when-clear = TRUE
   bmopt.chCodeJock = chQFilterItem
   bmopt.iCodeJockCreate = bm-option-icjseq
   bm-option-icjseq = bm-option-icjseq + 1.
chQFilterItem:Text = "<Not selected>":T25.

/* Notify of value changes in controls */
PROCEDURE CbfFrame.commandbarsframe.ControlNotify:
   DEFINE INPUT PARAMETER chSelf AS COM-HANDLE NO-UNDO.
   DEFINE INPUT PARAMETER iCode AS INTEGER NO-UNDO.
   DEFINE INPUT PARAMETER h1 AS HANDLE NO-UNDO.
   DEFINE OUTPUT PARAMETER lHandled AS LOGICAL NO-UNDO.
   CASE get-id(chSelf:ID):
      WHEN "QFIELD":U OR WHEN "QOPER":U THEN IF iCode = 8 THEN RUN GetSetQuickFilter.
      WHEN "QMATCH":U THEN IF iCode = 512 THEN RUN GetSetQuickFilter.
   END CASE.
END PROCEDURE.

PROCEDURE GetSetQuickFilter PRIVATE:
   DEFINE BUFFER bmopt FOR bm-option.
   DEFINE BUFFER bmopt2 FOR bm-option.

   FOR FIRST bmopt WHERE bmopt.cAction = "QMATCH":U AND bmopt.main-type = "QFILTER":U NO-LOCK:
      bmopt.chCodeJock:Text = "<Not selected>":T25.
      FOR FIRST bmopt2 WHERE bmopt2.cAction = "QOPER":U AND bmopt2.main-type = "QFILTER":U NO-LOCK:
         IF VALID-HANDLE(bmopt2.chCodeJock) THEN bmopt2.chCodeJock:Listindex = 1.
         /*
         bmopt2.chCodeJock:Text = "Includes":T25.
         */
      END.
   END.
END PROCEDURE.



Posted By: Aaron
Date Posted: 08 April 2008 at 6:44am
Hi,
 
I do not understand how your code works (and I thought I have seen them all ) but I see that you use a procedure to handle the ControlNotify event. You can do the same for the Update event (this event will be fired when commandbars needs to be updated). In your case detecting a value from the combobox. I guess this would be like this:
 
PROCEDURE CbfFrame.commandbarsframe.Update:
   DEFINE INPUT PARAMETER chSelf AS COM-HANDLE NO-UNDO.
   DEFINE INPUT PARAMETER iCode AS INTEGER NO-UNDO.
   DEFINE INPUT PARAMETER h1 AS HANDLE NO-UNDO.
   DEFINE OUTPUT PARAMETER lHandled AS LOGICAL NO-UNDO.
   CASE get-id(chSelf:ID):
        WHEN chSelf == "QFIELD":U THEN ????? compare the ID with the control given ID
 
        chSelf.listindex (this will be the index of selected item)
        chSelf.text (this will be the value of selected item)
 
   END CASE.
END PROCEDURE.
 
If this doesn't work (or if isn't possible) you better ask someone who is more experienced in your language.


Posted By: torbenjc
Date Posted: 08 April 2008 at 8:36am
Thank you  It seems likeI finally got the update trigger to work!


Posted By: Aaron
Date Posted: 08 April 2008 at 11:52am

Hi,

Good for you. Now I can say I helped someone with OpenEdge
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net