/ Forums / Advansys Formativ / Creating Solutions with Formativ / events on press toolbarbutton

  • Creator
    Topic
  • #4225
    robinson
    Participant

    hi,

    im a newbie using vbs & formativ.

    my question, how can i create a applet with a toolbar button.

    if the button is pressed a certain string should be added in the subject. (button is marked is pressed)

    if i press the button again the string should be removed from the subject. (button is marked as not aktiv)

    this is my beginning for adding the string

    Sub Main(Client, GWEvent)
    dim OldSubject
    dim AddSubject

    call GroupWise.FocusSet(9, "")

    OldSubject = GroupWise.ItemGetText("X00", 9)
    AddSubject = "[somestring] "

    If (InStr(1, OldSubject, AddSubject, vbTextCompare) > 0) then
    call GroupWise.ItemSetText("X00", 9,OldSubject, false)
    else
    call GroupWise.ItemSetText("X00", 9,AddSubject + OldSubject, false)
    end if
    End Sub

    thx for your help

  • Author
    Replies
  • #7537
    Support 3
    Participant

    You can add toolbar button to GroupWise Main Window or each message type (mail, task, note, etc) window. Open the Formativ IDE then go to the Integrations tab and check toolbar option. You may need to restart GroupWise to see the appropriate toolbar buttons appearing.

    You can not change the toolbar button appearance as you described above. May be you can have two distinct applets to perform the task or you can change the applet operation based on a key pressed.

    The sample code below add some text to the message subject when the toolbar button pressed. If the CTRL key was pressed when the applet execute then the applet will remove the text from the message subject. See the Formativ Language Guide for more information about the KeyIsDown method.

      
       dim OldSubject
       dim AddSubject
    
       call GroupWise.FocusSet(9, "")
    
       ' Is the CTRL key down?
       iRemoveText = utilities.KeyIsDown(VK_CONTROL)
    
       OldSubject = GroupWise.ItemGetText("X00", 9)
       AddSubject = "[somestring] "
    
       ' Remove text from the subject if the CTRL key down otherwise insert the text.
       if iRemoveText then
         If (InStr(1, OldSubject, AddSubject, vbTextCompare) > 0) then
           OldSubject = replace(OldSubject, AddSubject, " ", 1, -1, vbTextCompare)
           call GroupWise.ItemSetText("X00", 9,OldSubject, false)
         end if
       else
         If (InStr(1, OldSubject, AddSubject, vbTextCompare) > 0) then
           call GroupWise.ItemSetText("X00", 9,OldSubject, false)
         else
           call GroupWise.ItemSetText("X00", 9,AddSubject + OldSubject, false)
         end if
       end if
    

    Hope this helps.

    Regards,
    Advansys Support

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.