Author Topic: TrailMyx's Tab Control and List Handler  (Read 24945 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
TrailMyx's Tab Control and List Handler
« on: March 12, 2010, 09:51:06 PM »
+2
Code: [Select]
;=================================================================
; Script Name: TrailMyx's Tab List Handling Subs
; Author: TrailMyx
; Version: 0.20
; Shard OSI / FS: OSI / FS OK
; Revision Date: 3/12/2010
; Purpose: Allows the scripter to create cool Tab lists like you'll find in scripts like the CLAw
;          autolooter found at ScriptUO.com --> http://www.scriptuo.com/index.php?topic=17.0
;
; Subroutines included:
;   TM_CreateTabControl - Creates a new tab control instance
;   TM_HandleTabs - Button handler for each tab control.  One handler is required for each control
;   TM_AddTab - Add a tab to a tab control
;   TM_HideTabControl - Hides the whole control
;   TM_ShowTabControl - Makes the tab control visible
;   TM_HideTabByName - hides a tab by name
;   TM_ShowTabByName - makes a tab visible by name
;
; Requirements:
;   Requires TM List functions.
;   http://www.scriptuo.com/index.php?topic=21.msg21#msg21
; Locals/Globals:
;   TMTABS_ , %2 (local)
;
; Special Thanks:
;
;=================================================================



So if you've ever used my CLAw user interface, you may have apprecated the "Tabs" that are created to allow you to change the view of the various ListBoxes.  However, it's a pain to implement by hand until now.  Utilizing my list handler subs, I created a new set of tools to help make your user interfaces more pretty.

Subs to come, but here's some sample code to see how easy it is:

Code: easyuo
  1. ;-----------------------------------------------------------------
  2. ;  Start of test code ----->
  3. set %list_functions c:\tool_listhandler29.txt ; required if you will be "calling" the list handler subs.
  4. set %font_arial MS , #SPC , Ariel
  5. set %called #FALSE ; assumes that functions are included in this file.  #TRUE to "call" them instead
  6. gosub showEUOMenu1
  7. gosub TM_CreateTabControl TabControl1 10 30 170 150 White WindowText %font_arial 8
  8. gosub TM_AddTab TabControl1 Fruit Fruit #TRUE ; #TRUE = hidden, #FALSE = visible
  9. gosub TM_AddTab TabControl1 Vegies Vegies #FALSE TestFunction
  10. gosub TM_AddTab TabControl1 FastFood FastFood #FALSE
  11. gosub TM_AddTab TabControl1 Planets Planets #FALSE
  12. gosub TM_AddToList TabControl1_Fruit bananna TAG
  13. gosub TM_AddToList TabControl1_Fruit apple TAG
  14. gosub TM_AddToList TabControl1_Fruit kiwi TAG
  15. gosub TM_AddToList TabControl1_Fruit grapes TAG
  16. gosub TM_AddToList TabControl1_Vegies carrot TAG
  17. gosub TM_AddToList TabControl1_Vegies onions TAG
  18. gosub TM_AddToList TabControl1_Vegies tomato TAG
  19. gosub TM_AddToList TabControl1_FastFood Windys TAG
  20. gosub TM_AddToList TabControl1_FastFood Burger , #SPC , King TAG
  21. gosub TM_AddToList TabControl1_FastFood Carls , #SPC , Jr. TAG
  22. gosub TM_AddToList TabControl1_Planets Mars
  23. gosub TM_AddToList TabControl1_Planets Uranus
  24. gosub TM_AddToList TabControl1_Planets Neptune
  25. gosub TM_AddToList TabControl1_Planets Jupiter
  26.  
  27. gosub TM_CreateTabControl TabControl2 200 30 170 150 White WindowText %font_arial 8
  28. gosub TM_AddTab TabControl2 Tab1 Tab1 #FALSE
  29. gosub TM_AddTab TabControl2 Tab2 Tab2 #FALSE
  30. gosub TM_AddTab TabControl2 Tab3 Tab3 #FALSE
  31. gosub TM_AddTab TabControl2 Tab4 Tab4 #FALSE
  32.  
  33. gosub TM_CreateTabControl TabControl3 30 220 150 150 White WindowText %font_arial 8
  34. gosub TM_AddTab TabControl3 Tab1 Tab1 #FALSE
  35. gosub TM_AddTab TabControl3 Tab2 Tab2 #FALSE
  36. gosub TM_AddTab TabControl3 Tab3 Tab3 #FALSE
  37. gosub TM_AddTab TabControl3 Tab4 Tab4 #FALSE
  38.  
  39. ; Lists are addressed as TabControl4_Tab1, 2, 3, 4
  40. gosub TM_CreateTabControl TabControl4 200 220 150 150 White WindowText %font_arial 8
  41. gosub TM_AddTab TabControl4 Tab1 Tab1 #FALSE
  42. gosub TM_AddTab TabControl4 Tab2 Tab2 #FALSE
  43. gosub TM_AddTab TabControl4 Tab3 Tab3 #FALSE
  44. gosub TM_AddTab TabControl4 Tab4 Tab4 #FALSE
  45.  
  46. gosub TM_HideTabControl TabControl3 ; hide the whole tab control
  47. gosub TM_ShowTabControl TabControl3 ; show the whole tab control, remembers what tabs where hidden
  48.  
  49. gosub TM_HideTabByName TabControl1 Planets
  50. gosub TM_ShowTabByName TabControl1 Fruit
  51.  
  52. gosub TM_CopyAllItemsInList TabControl1_Planets TabControl2_Tab2 #FALSE #FALSE
  53. gosub TM_CopyAllItemsInList TabControl1_Planets TabControl3_Tab3 #FALSE #FALSE
  54. gosub TM_CopyAllItemsInList TabControl1_Planets TabControl4_Tab4 #FALSE #FALSE
  55.  
  56. gosub TM_SelectTabByName TabControl2 Tab2
  57. gosub TM_SelectTabByName TabControl3 Tab3
  58.  
  59. repeat
  60.   gosub TM_HandleTabs TabControl1
  61.   gosub TM_HandleTabs TabControl2
  62.   gosub TM_HandleTabs TabControl3
  63.   gosub TM_HandleTabs TabControl4
  64. until #FALSE
  65.  
  66. sub TestFunction
  67.   display ok Function Called!
  68. return
  69. stop
  70. ;  <------ End of test code
  71.  

And see the attached picture to see the results.  Notice the TM_HandleTabs automatically handles the view change between tabs for each tab control.  A tab control is a grouping of tabs much like you see in a normal Windows program.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_tabhandler2.txt
« Last Edit: August 06, 2021, 08:40:55 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Tab List Handler
« Reply #1 on: March 12, 2010, 10:07:00 PM »
+2
You are a steely eyed missle man.  NEW TOYS! :)  Merry Christmas to Twinkle McNugget!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #2 on: March 12, 2010, 10:34:30 PM »
+2
You are a steely eyed missle man.  NEW TOYS! :)  Merry Christmas to Twinkle McNugget!


This is one I've wanted to write for a long time.  The basics are working pretty well.  Just adding some features.  Since the underlying code is from the list handlers, you can easily copy information from one tab control to another.  It's kinda hard-coded in the CLAw, but these are very generic and pretty easy to use.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #3 on: March 12, 2010, 10:38:19 PM »
+2
I'll even have a handler that you can program and run a routine of your own choosing when the tab button is pressed and the tab contents are redrawn.  It'll be pretty cool.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Tab List Handler
« Reply #4 on: March 12, 2010, 11:37:15 PM »
+2
I'll even have a handler that you can program and run a routine of your own choosing when the tab button is pressed and the tab contents are redrawn.  It'll be pretty cool.

What's that mean?  You're the one writing it. :)  Handler I can program to run what kind of routing?  OH like click a tab and run one of your list subs?  OOOOooooo heh

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #5 on: March 13, 2010, 12:17:54 AM »
+2
Right now, I handle the button click for each tab control to switch out the lists and draw them.  However, if you want to include a function that's run at the button press, you can just include that as one of the arguments in the TM_AddTab.  I've got the first version ready to go and will post it right now.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Tab List Handler
« Reply #6 on: March 13, 2010, 12:40:25 AM »
+2
Right now, I handle the button click for each tab control to switch out the lists and draw them.  However, if you want to include a function that's run at the button press, you can just include that as one of the arguments in the TM_AddTab.  I've got the first version ready to go and will post it right now.

Is it as fast as the list subs?  Cause honestly when you get 200+ names in the lists... it gets a little combersome to arrange/save.  Loading is still pretty snappy tho. :)

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #7 on: March 13, 2010, 12:46:58 AM »
+2
Should be the same really.  Subs aren't slow, just EUO is slow iterating all that stuff.

Now that these subs are out of the way, it'll pave the way for my new file system.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Tab List Handler
« Reply #8 on: March 13, 2010, 10:33:21 AM »
+2
Should be the same really.  Subs aren't slow, just EUO is slow iterating all that stuff.

Now that these subs are out of the way, it'll pave the way for my new file system.

I'm trying to come up with a neat way to implement this in the targetter.  But honestly I think the list subs give it just enough functionality.  Wait... can't you select multiple items in a list?  Is there a way to setup a list to be that way?  Maybe a flag to set it so one list in a tab can be normal, and the next can be "flagged" so that you can select multiple items in a list, and when you scan them, it will find EACH item is #true for selection and shows blue like it's selected?  I'm pretty sure I remember selecting multiple items in a list, I just tried in yours and couldn't tho.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #9 on: March 13, 2010, 11:59:54 AM »
+2
You can't select multiple items in an EUO list anyhow.  EUO limitation again.  With Windows Forms, you can set up a ListBox to allow for multiple selections, but EUO doesn't pass that through to the scripter.

So there's nothing I can do for you.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab List Handler
« Reply #10 on: March 13, 2010, 01:18:54 PM »
+2
I'm not going to be changing the base functions as implemented so far.  Probably going to add a few other functions.  I realized I didn't add a "DeleteTab" function.  You can hide tabs,  just not delete them yet.

So if you wanted to play a bit with these, I doubt the base code will change that much.  I only started these yesterday, so they are pretty new and not tested other than my sample code.  But their functionality greatly comes from the list handling subs which have some usage.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: TrailMyx's Tab Control and List Handler
« Reply #11 on: March 23, 2010, 06:02:54 AM »
+2
Another Nice one
Your releaseing  some great bits of code lately TM

:)


Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab Control and List Handler
« Reply #12 on: March 23, 2010, 08:28:08 AM »
+2
Same to you; everyone is being pretty creative lately so I thought I would jump on the bandwagon.  ;)

These will get really interesting when I fuse it with my new advanced filesystem.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's Tab Control and List Handler
« Reply #13 on: March 23, 2010, 08:35:10 AM »
+2
I've been looking for a way to incorporate this into my current personal project, once the filesystem is done, I'll try to add this and if it works out I'll send it to you and see what ya think. :)  I got a pretty great idea for it. heh

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: TrailMyx's Tab Control and List Handler
« Reply #14 on: March 23, 2010, 08:37:34 AM »
+2
I have a few more features to add to this as well.  I thought of a few nice additions.
Please read the ScriptUO site RULES
Come play RIFT with me!