New call-to-action
Results 1 to 6 of 6

Thread: password a tab

  1. #1
    "Certified" Alphaholic
    Real Name
    Charlie Crimmel
    Join Date
    Apr 2000
    Location
    West Virginia
    Posts
    1,695

    Default password a tab

    To All
    I have a tabbed form with 5 tabs.

    Is there a way to password tab number 5 and only allow access if the correct password is entered.

    I tried on tab change event, but I could not get the correct syntax.

    Charlie Crimmel

  2. #2
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,656

    Default RE: password a tab

    Charlie,

    Try this:
    Code:
    'OnTabChange Event
    
    vPwd = "TMP" 
    
    IF tabbed1.tab_get() = 2 
    		vUserPwd = ui_get_password("Password","Enter the password","","&") 
    		IF vUserPwd = vPwd THEN 	
    			ui_msg_box( "Password", "Accepted." ) 
    			END 
    		ELSE
    			tabbed1.tab_set(1)
    			sys_send_keys("{tab}") 
    			ui_beep() 
    			ui_msg_box( "Password", "Password invalid." ) 
    		END IF
    END IF
    END
    Peter
    Last edited by AaronBBrown; 03-20-2007 at 11:56 AM.

  3. #3
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,963

    Default RE: password a tab

    Charlie, here is a script that is working - but the only way I can get it to work, in a practical sense, is to hide the embedded browse in the tab. There could be other objects that you might have to address/hide and show in your own particular case. You don't really need to reshow them (thus unhiding them) if they don't give you the correct password, as it will fire eveytime they click that tab.

    you could sophisticate it by allowing the "loggedin user" rights.
    Code:
    if busy 'keep it from firing twice
    	end
    end if 
    busy=.t.
    if Master_Form:tabbed1.Tab_Get()=3 'the tab# to control
    '	Master_Form:tabbed1.Hide()
    '	xbasic_wait_for_idle()	
    '	Master_Form:tabbed1.refresh()	
    '	xbasic_wait_for_idle()
    	browse2.hide()
    	xbasic_wait_for_idle()	
    	ans=ui_get_radio("Select",1,"one","two")
    	if ans="one"
    		browse2.show()
    		xbasic_wait_for_idle()			
    '		Master_Form:tabbed1.show()
    	else
    		Master_Form:tabbed1.Tab_set(1) 'or some other tab#
    		tabbed1.refresh()
    	end if 
    end if 
    xbasic_wait_for_idle()
    busy=.f.
    Last edited by AaronBBrown; 03-20-2007 at 11:56 AM.

  4. #4
    Doug Oconnor
    Guest

    Default RE: password a tab

    Peter

    I tryed your sugestion on passwording a tab. It works great on tab # 2 But when I change it to Tab # 5 (which is the one I would like the password on) I am having problems.
    It work, but if you double click on # 5 tab it opens both the password entry box & the tab. you can not enter or change data, but you can still see data under the password
    screen.
    I may not have change the tab properly.

    I changed
    IF tabbed1.tab_get() = 2
    to:
    IF tabbed1.tab_get() = 5

    Any sugestions?

    Doug Oconnor

  5. #5
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,656

    Default RE: password a tab

    I just created a 6 tab tabber and put that code in it, and set it to "=5". When I double click on the tab 5 heading I CAN'T see the contents of the tab and the password dialog comes up. Works correctly. If you can't figure it out, post it here.

  6. #6
    Member
    Real Name
    Greg Skiathitis
    Join Date
    Mar 2006
    Posts
    37

    Default Re: password a tab

    Quote Originally Posted by Peter.Greulich View Post
    Charlie,

    Try this:
    Code:
    'OnTabChange Event
    
    vPwd = "TMP" 
    
    IF tabbed1.tab_get() = 2 
    		vUserPwd = ui_get_password("Password","Enter the password","","&") 
    		IF vUserPwd = vPwd THEN 	
    			ui_msg_box( "Password", "Accepted." ) 
    			END 
    		ELSE
    			tabbed1.tab_set(1)
    			sys_send_keys("{tab}") 
    			ui_beep() 
    			ui_msg_box( "Password", "Password invalid." ) 
    		END IF
    END IF
    END
    Peter

    Hi Peter and thanks for this info, it's exactly what I'm looking for but for some reason it comes up and asks for the password, I enter it and it is accepted but then a dialogue box with "Invalid Password" appears.

    EDIT: Thanks Peter have it working a treat now. Was a silly syntax error on my part!
    Thanks in advance,

    Regards
    Hawky
    Last edited by AaronBBrown; 03-20-2007 at 11:57 AM.

Similar Threads

  1. V7 Password
    By John Gamble in forum Alpha Five Version 6
    Replies: 2
    Last Post: 08-24-2005, 06:55 PM
  2. password
    By Edgar Lewis in forum Alpha Five Version 5
    Replies: 4
    Last Post: 03-09-2003, 10:25 AM
  3. password
    By Edgar Lewis in forum Alpha Five Version 5
    Replies: 13
    Last Post: 02-02-2003, 08:49 PM
  4. Password
    By Keith Hubert in forum Alpha Five Version 5
    Replies: 3
    Last Post: 12-14-2002, 03:20 PM
  5. PASSWORD
    By jack rosen in forum Alpha Four Versions 7 and 8
    Replies: 0
    Last Post: 10-06-2002, 05:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •