SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to lock buttons in designsteps

    Hi

    I use QC 9.2, patch lvl: 9.2.0.4862, DB server: SQL Server 2000

    I have a problem concerning the buttons in designsteps/testplan. The buttons "New Step", "Edit Step", "Renumber Step" & "Delete Selected" need to be locked when a testplan is in a sudden mode. I have tried to place the following script in the Function ActionCanExecute(ActionName), but it does not work. Any suggestions?

    If actionname = "act_new_step" or actionname = "act_edit_step" or "act_renumber_step" or "act_delete_step" Then
    If Test_Fields.Field("TS_STATUS").Value = "Godkendt" Then
    actioncanexecute = false
    End if
    End if

    Regards Thomas

  2. #2
    Advanced Member
    Join Date
    Aug 2004
    Location
    Wellington, New Zealand
    Posts
    797
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Check your capitalisation.

    Going by what you've written above, the first line should begin with "If ActionName = "
    and the result should be "ActionCanExecute = False"
    Regards,

    Alex
    ... just another Tester ...

  3. #3
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Hi Asher

    Thank you very much for your answer - now it works [img]/images/graemlins/smile.gif[/img] I modified the script and also blocked out this line: " ActionCanExecute = DefaultRes". As I see it, the above mentioned line kind of negate this line: "ActionCanExecute = False"? Is that correct?

    Regards
    Thomas

  4. #4
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Hi Asher

    I did not test the script well enough before [img]/images/graemlins/frown.gif[/img] The thing is, that the script does not work unless I block this line: "ActionCanExecute = DefaultRes". But then it is not only the buttons in the designstep section that are locked - several buttons in I.E the Manual runner are also affected.

    I have posted my entire Function ActionCanExecute(ActionName) below - can you tell me, what I am doing wrong?

    Best regards
    Thomas

    Function ActionCanExecute(ActionName)
    'Use ActiveModule and ActiveDialogName to get
    'the current context.
    On Error Resume Next

    If ActionName = "act_new_step" Then
    If Test_Fields.Field("TS_STATUS").Value = "Ready" Then

    ActionCanExecute = False

    End if
    End if

    ActionCanExecute = DefaultRes
    On Error GoTo 0
    End Function

  5. #5
    Senior Member
    Join Date
    Nov 2008
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    1. Put for debug time this line after On Error... It will prvide to you right action names:

    MsgBox ActionName

    2. Try to move DefRes to the beginning:
    Function ActionCanExecute(ActionName)
    'Use ActiveModule and ActiveDialogName to get
    'the current context.
    On Error Resume Next

    'Only for debug time
    MsgBox ActionName

    'Any Action will be allowed
    ActionCanExecute = DefaultRes

    If (ActionName = "act_new_step") or (<other actions&gtThen
    If Test_Fields.Field("TS_STATUS").Value = "Ready" Then
    'Forbid only proper action
    ActionCanExecute = False
    End if
    End if

    On Error GoTo 0
    End Function

    Try now.

  6. #6
    Advanced Member
    Join Date
    Aug 2004
    Location
    Wellington, New Zealand
    Posts
    797
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Tomat:
    Sorry I wasn't paying attention to the rest of your code.. just the variable handling. [img]/images/graemlins/frown.gif[/img]

    By commenting out the = DefaultRes line you're preventing any and all actions being set to 'True' in that module, which is why nothing works as it should.

    What you need to do is set ActionCanExecute to False ONLY for specified Actions when Test_Fields.Field("TS_STATUS").Value = "Godkendt", and in all other cases it should be True/DefaultRes.

    SergLA's code will work as it does the operations in the reverse order - it sets the response to default then overwrites it if necessary.

    The other option is to make the following changes:


    Function ActionCanExecute(ActionName)
    On Error Resume Next

    Dim StrRestrictedActions
    StrRestrictedActions = "act_edit_step,act_renumber_step,act_delete_st ep" ' I haven't checked these, I assume you have the ActionName's correct. SergLA's tip to get the exact name is the best one if you're unsure.

    If Instr(StrRestrictedActions,ActionName) AND Test_Fields.Field("TS_STATUS").Value = "Ready" Then
    ActionCanExecute = False
    Else ActionCanExecute = DefaultRes
    End if
    Regards,

    Alex
    ... just another Tester ...

  7. #7
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Hi SergLA

    I have placed the line: "ActionCanExecute = DefaultRes" above the line: "ActionCanExecute = False" and now it works. I have tested it several times and now the change is in our prodcution environment.

    Thank you very much for your answer! [img]/images/graemlins/smile.gif[/img]

    Best regards
    Thomas

  8. #8
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Hi Asher

    Thank you very much for your answer. I will try your solution later on today [img]/images/graemlins/smile.gif[/img]

    Best regards
    Thomas

  9. #9
    Senior Member
    Join Date
    Nov 2008
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Asher's solution is prettier)))) From programmer point of view)

  10. #10
    Member
    Join Date
    Nov 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to lock buttons in designsteps

    Hi Asher

    I have tried what you suggested and the script works absolutely fine.

    But I have one question - what does this line do: If Instr(StrRestrictedActions,ActionName)? I know it is an If sentence, but what puzzle me is this: If Instr - what is Instr and what does it do?

    Thomas

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:12 PM.

Copyright BetaSoft Inc.