Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Change Label properties

Is it possible to Set the properties "Set_Property(OLECtrlEntID, ???[Key],text)" of a label via the commuter module.
Would like to change text displayed on the ribbon after pressing a button.

Any advice would be grateful.

Chris

Comments

  • Try 4.0.3 RC9. New property is called LabelText:

    Set_Property(MyRibbonCtrl, "OLE.LabelText[MY_LABEL]", "Hello World!")
  • I have downloaded an registered (as above) the new SRPControls.ocx and the caption associated with a label does not change. Am I doing something wrong?
  • edited October 2016
    I can't say without seeing code. I'd have to see the XML snippet defining your label along with the code you are using to change its text.
  • Kevin,
    Is the format of the set_property correct? Should it not be:

    Set_Property(MyRibbonCtrl, "OLE.LabelText[":@Window:";MY_LABEL":"]", "Hello World!")
  • Barry, that is not correct since the index is referencing a Ribbon control, not an OI control. All that matters is that the text within the square brackets matches the Key used to define the label.
  • edited October 2016
    Hi Kevin,

    I know it looks a little weird but while trying the new function this is the latest XML.
    <Group Key="MDI2015_SCHED*DETAILS" Caption="Scheduler Details" OptionButton="false" Icon=".\Images\rules32.png">
    <Label Key="MDI2015_SCHED*LBL_BUTTON" Caption="Schedule" />
    <Label Key="MDI2015_SCHED*LBL_TEST" Caption="TEST" />
    <Label Key="MDI2015_SCHED*LBL_START" Caption="Start Date" />
    <Label Key="MDI2015_SCHED*LBL_END" Caption="End Date" />
    <Button Key="MDI2015_SCHED*BTN_TASK" Command="SCHED*DETAILS*HR" />
    <ComboBox Key="MDI2015_SCHED*TASK" Tooltip="Select scheduler Task." Width = "200">

    <Item>Enter Task with a long text message</Item>
    <Item>Enter Task2</Item>

    </ComboBox>
    <!--DateField Key="MDI2015_SCHED*START" Width="100" Tooltip="Enter Start Date for Scheduler" />
    <DateField Key="MDI2015_SCHED*END" Width="100" Tooltip="Enter End Date for Scheduler" /-->
    </Group>
    Then OI updates the items in the combo box with some descriptions from a file for selection then update the display on the ribbon showing when the next schedule is to occur. This is a 2 stage process to keep the new scheduler processes all together:

    OnComboSelChange: ControlKey = Param1 NewValue = Param2 Begin Case Case ControlKey[1,13] _Eqc "MDI2015_SCHED" ; MDI2015_Scheduler_Events(ControlKey) Case 1 If NewValue then * winlist = Kazm_Utility('WINDOWLIST', true$) winlist = Kazm_Utility('WINDOWLIST', False$) Locate NewValue in winlist<3> using @vm setting pos then FormKey = Winlist<1,pos> Void = Set_Property(Formkey,'VISIBLE',1) end end End Case Return

    then in the MDI2015_Scheduler_Events routine:

    DropDown_Task: Task = Get_Property(Ole_Ribbon$,"OLE.ComboText[":Ctrlentid:']') ShedKey = Field(Task,'|',2) NextDate = Oconv(Xlate('PBC_SCHEDULES',ShedKey,'SCHEDULE_DATE','X'),'D') Void = Set_Property(Ole_Ribbon$, "OLE.LabelText[MDI2015_SCHED*LBL_TEST]", "Hello World!") Void = Set_Property(Ole_Ribbon$, "OLE.LabelText[MDI2015_SCHED*DETAILS]", "Hello World!") debug Return

    Will replace "Hello World" with the NextDate text once the ribbon is working.

    BTW the routine seems to be going trough the debug twice.

    Hope this helps.
  • Hi Keviv,

    Pasting the xml code does not appear in the previous response. Did you want me to send via email?

    Chris
  • I fixed the post. Since these forums accept Simple HTML, pasting XML can be a problem.

    So far I can't explain your problem. The code looks correct as does the XML. I created a simple test on my end using your same Key values, and it worked. The only difference I can think of is that you are changing things during a Ribbon event. Perhaps that's a key, but I won't be able to test until later tonight because I am onsite at a client's. Perhaps the registration of the new OCX didn't take, or you accidentally registered an older version. Barring that, I'll need to do more investigation.

    In the meantime, if you discover anything else that might help, let me know.
  • edited October 2016
    I do notice one discrepancy. MDI2015_SCHED*DETAILS is a group, not a label control. LabelText will not change a group's caption. It only changes label text. Could that be the issue?
Sign In or Register to comment.