AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUI Tabs - Transfer Control Contents Across Tabs?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Fri Aug 03, 2007 2:03 pm    Post subject: GUI Tabs - Transfer Control Contents Across Tabs? Reply with quote

I'm trying to make a lightweight emergency response form for when the IT department decides to start upgrading our database at the office. Laughing

What I have is three tabs, one each for service, supplies, and customer care. In my perfect world, certain fields would be 'shared' across the tabs, such as customer account number, contact name, etc.

I know I can't re-use the same variable name in different tabs, but I'm wondering if there's a way to get the account number entered in the service tab to carry over into the supplies tab.

From what little I understand about AHK GUI stuff, I don't think it is possible without some kind of Gui, Submit function that would take the submitted variable from one tab and add it as the default value to the GUI line for the control on the other tab...

Test scenario and code:

Customer calls in for service and supplies, agent enters account number and service reason, submits it, then clicks the supplies tab, and enters just the supply item as account number is pre-populated.

Code:
Gui, Add, Tab, x-4 y0 w250 h100 , Service|Supplies
Gui, Tab, Service
Gui, Add, Text, x6 y30 w70 h20 , Account #
Gui, Add, Edit, x76 y30 w100 h20 vSvcAcctNum
Gui, Add, Text, x6 y50 w70 h30 , Reason for Service
Gui, Add, Edit, x76 y50 w100 h30 vSvcReason
Gui, Tab, Supplies
Gui, Add, Text, x6 y30 w70 h20 , Account #
Gui, Add, Edit, x76 y30 w100 h20 vSupAcctNum
Gui, Add, Text, x6 y50 w70 h30 , Supply Item Needed
Gui, Add, Edit, x76 y50 w100 h30 vSupplyItem
Gui, Show, x341 y231 h100 w246, Service and Supplies Emergency Form
Return

GuiClose:
ExitApp


I realize that I can do this by having the 'shared' controls be outside the GUI Tab section, but I want to keep everything in the tabs because it looks nicer imho.

It isn't a big deal if the fields can't be carried over across tabs, since customers usually only call for ONE issue, but it would be nice. If the solution is very complex, it probably wouldn't be worth it.

As always any help is greatly appreciated!
_________________
[Join IRC!]
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Aug 03, 2007 2:08 pm    Post subject: Reply with quote

you are right that you should move "shared" fields outside the tabs. It is bad interaction design to make the user refill them in, and getting the data to propagate between the tabs is more work than changing the layout.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
daniel2



Joined: 23 Jul 2007
Posts: 47

PostPosted: Fri Aug 03, 2007 3:36 pm    Post subject: Re: GUI Tabs - Transfer Control Contents Across Tabs? Reply with quote

Rhys wrote:
I know I can't re-use the same variable name in different tabs, but I'm wondering if there's a way to get the account number entered in the service tab to carry over into the supplies tab.

You could always make a routine that syncs the fields when you change tab.
Code:
Gui, Add, Tab, x-4 y0 w250 h100 gSwitchTab vPreviousTab, Service|Supplies
Gui, Tab, Service
Gui, Add, Text, x6 y30 w70 h20 , Account #
Gui, Add, Edit, x76 y30 w100 h20 vSvcAcctNum
Gui, Add, Text, x6 y50 w70 h30 , Reason for Service
Gui, Add, Edit, x76 y50 w100 h30 vSvcReason
Gui, Tab, Supplies
Gui, Add, Text, x6 y30 w70 h20 , Account #
Gui, Add, Edit, x76 y30 w100 h20 vSupAcctNum 
Gui, Add, Text, x6 y50 w70 h30 , Supply Item Needed
Gui, Add, Edit, x76 y50 w100 h30 vSupplyItem
Gui, Show, x341 y231 h100 w246, Service and Supplies Emergency Form
Return

GuiClose:
ExitApp

SwitchTab:      ;--this will make sure your account# fields are synced..
  If PreviousTab = Service
    Previous_EditCtrl := "SvcAcctNum" , Current_EditCtrl := "SupAcctNum"
  Else If PreviousTab = Supplies
    Previous_EditCtrl := "SupAcctNum" , Current_EditCtrl := "SvcAcctNum"

  GuiControlGet, %Previous_EditCtrl%
  GuiControl,, %Current_EditCtrl%, % %Previous_EditCtrl%
return
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group