home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Plugin Development Question
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="arion_p" data-source="post: 547620" data-attributes="member: 45945"><p>Actually there is not need for the field to be static. Just use the code I supplied above like this:</p><p>[code]public class MyRolodexMainMenu : GUIWindow, ISetupForm</p><p> { </p><p></p><p>protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)</p><p> {</p><p> MyRolodexModifyContact editWin = (MyRolodexModifyContact)GUIWindowManager.GetWindow(13001);</p><p> MyRolodexOtherWindow otherWin = (MyRolodexOtherWindow)GUIWindowManager.GetWindow(13002);</p><p> </p><p> switch (controlId)</p><p> {</p><p> case 2:</p><p> otherWin.Letter = "A";</p><p> GUIWindowManager.ActivateWindow(13002);</p><p> break;</p><p></p><p> Case ...: ( JUST MORE CASES FOR EACH BUTTON )</p><p> ...........</p><p> break;</p><p></p><p> case 30: // This is the add contact button</p><p> editWin.ScreenChoice = "0";</p><p> GUIWindowManager.ActivateWindow(13001);</p><p> break;</p><p></p><p> case 31: // This is the edit contact button</p><p> editWin.ScreenChoice = "1";</p><p> GUIWindowManager.ActivateWindow(13001);</p><p> break;</p><p></p><p> case 32: // This is the delete contact button</p><p> editWin.ScreenChoice = "2";</p><p> GUIWindowManager.ActivateWindow(13001);</p><p> break;</p><p>[/code]Assuming of course your MyRolodexModifyContact does something like this:</p><p>[code]public class MyRolodexModifyContact : GUIWindow</p><p> {</p><p></p><p>public string ScreenChoice = ""; //initialize to empty string to avoid null ref exception</p><p></p><p>private void InitializeContacts()</p><p> {</p><p> DataRow dRow = ds1.Tables["MyContacts"].Rows[GetContactChoice()]; </p><p> </p><p> switch (ScreenChoice)</p><p> {</p><p></p><p> case "0":</p><p> NewName.Label = "Please Enter Name";</p><p> NewEmail.Label = "Email Address";</p><p> NewPhoneHome.Label = "Home Phone";</p><p> NewPhoneMobile.Label = "Mobile Phone";</p><p> NewAddressStreet.Label = "Street";</p><p> NewAddressCity.Label = "City";</p><p> NewAddressState.Label = "ST";</p><p> NewAddressZip.Label = "Zip Code";</p><p> break;</p><p></p><p> case "1":</p><p> NewName.Label = dRow.ItemArray.GetValue(0).ToString();</p><p> NewEmail.Label = dRow.ItemArray.GetValue(1).ToString();</p><p> NewPhoneHome.Label = dRow.ItemArray.GetValue(2).ToString();</p><p> NewPhoneMobile.Label = dRow.ItemArray.GetValue(3).ToString();</p><p> NewAddressStreet.Label = dRow.ItemArray.GetValue(4).ToString();</p><p> NewAddressCity.Label = dRow.ItemArray.GetValue(5).ToString();</p><p> NewAddressState.Label = dRow.ItemArray.GetValue(6).ToString();</p><p> NewAddressZip.Label = dRow.ItemArray.GetValue(7).ToString();</p><p> break;</p><p></p><p> case "2":</p><p> NewName.Label = dRow.ItemArray.GetValue(0).ToString();</p><p> NewEmail.Label = dRow.ItemArray.GetValue(1).ToString();</p><p> NewPhoneHome.Label = dRow.ItemArray.GetValue(2).ToString();</p><p> NewPhoneMobile.Label = dRow.ItemArray.GetValue(3).ToString();</p><p> NewAddressStreet.Label = dRow.ItemArray.GetValue(4).ToString();</p><p> NewAddressCity.Label = dRow.ItemArray.GetValue(5).ToString();</p><p> NewAddressState.Label = dRow.ItemArray.GetValue(6).ToString();</p><p> NewAddressZip.Label = dRow.ItemArray.GetValue(7).ToString();</p><p> break;</p><p> }[/code]And I just used <strong>MyRolodexOtherWindow</strong> as the name of the window for ID 13002, where you have to do something similar but implement the field <strong>Letter</strong> instead of <strong>ScreenChoice</strong>. In fact you can have however complex fields you like and/or you can use public methods instead of public fields to pass whatever you want (SetMode() was just an example - you do not necessarily need to pass a bool, you can pass whatever you want as long as you define your method appropriately).</p></blockquote><p></p>
[QUOTE="arion_p, post: 547620, member: 45945"] Actually there is not need for the field to be static. Just use the code I supplied above like this: [code]public class MyRolodexMainMenu : GUIWindow, ISetupForm { protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { MyRolodexModifyContact editWin = (MyRolodexModifyContact)GUIWindowManager.GetWindow(13001); MyRolodexOtherWindow otherWin = (MyRolodexOtherWindow)GUIWindowManager.GetWindow(13002); switch (controlId) { case 2: otherWin.Letter = "A"; GUIWindowManager.ActivateWindow(13002); break; Case ...: ( JUST MORE CASES FOR EACH BUTTON ) ........... break; case 30: // This is the add contact button editWin.ScreenChoice = "0"; GUIWindowManager.ActivateWindow(13001); break; case 31: // This is the edit contact button editWin.ScreenChoice = "1"; GUIWindowManager.ActivateWindow(13001); break; case 32: // This is the delete contact button editWin.ScreenChoice = "2"; GUIWindowManager.ActivateWindow(13001); break; [/code]Assuming of course your MyRolodexModifyContact does something like this: [code]public class MyRolodexModifyContact : GUIWindow { public string ScreenChoice = ""; //initialize to empty string to avoid null ref exception private void InitializeContacts() { DataRow dRow = ds1.Tables["MyContacts"].Rows[GetContactChoice()]; switch (ScreenChoice) { case "0": NewName.Label = "Please Enter Name"; NewEmail.Label = "Email Address"; NewPhoneHome.Label = "Home Phone"; NewPhoneMobile.Label = "Mobile Phone"; NewAddressStreet.Label = "Street"; NewAddressCity.Label = "City"; NewAddressState.Label = "ST"; NewAddressZip.Label = "Zip Code"; break; case "1": NewName.Label = dRow.ItemArray.GetValue(0).ToString(); NewEmail.Label = dRow.ItemArray.GetValue(1).ToString(); NewPhoneHome.Label = dRow.ItemArray.GetValue(2).ToString(); NewPhoneMobile.Label = dRow.ItemArray.GetValue(3).ToString(); NewAddressStreet.Label = dRow.ItemArray.GetValue(4).ToString(); NewAddressCity.Label = dRow.ItemArray.GetValue(5).ToString(); NewAddressState.Label = dRow.ItemArray.GetValue(6).ToString(); NewAddressZip.Label = dRow.ItemArray.GetValue(7).ToString(); break; case "2": NewName.Label = dRow.ItemArray.GetValue(0).ToString(); NewEmail.Label = dRow.ItemArray.GetValue(1).ToString(); NewPhoneHome.Label = dRow.ItemArray.GetValue(2).ToString(); NewPhoneMobile.Label = dRow.ItemArray.GetValue(3).ToString(); NewAddressStreet.Label = dRow.ItemArray.GetValue(4).ToString(); NewAddressCity.Label = dRow.ItemArray.GetValue(5).ToString(); NewAddressState.Label = dRow.ItemArray.GetValue(6).ToString(); NewAddressZip.Label = dRow.ItemArray.GetValue(7).ToString(); break; }[/code]And I just used [B]MyRolodexOtherWindow[/B] as the name of the window for ID 13002, where you have to do something similar but implement the field [B]Letter[/B] instead of [B]ScreenChoice[/B]. In fact you can have however complex fields you like and/or you can use public methods instead of public fields to pass whatever you want (SetMode() was just an example - you do not necessarily need to pass a bool, you can pass whatever you want as long as you define your method appropriately). [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Plugin Development Question
Contact us
RSS
Top
Bottom