Official ScriptUO EasyUO Scripts > Script development tools

TrailMyx's Tab Control and List Handler

(1/5) > >>

TrailMyx:

--- Code: ---;=================================================================
; 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:
;
;=================================================================

--- End code ---



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 ---;-----------------------------------------------------------------;  Start of test code ----->set %list_functions c:\tool_listhandler29.txt ; required if you will be "calling" the list handler subs.set %font_arial MS , #SPC , Arielset %called #FALSE ; assumes that functions are included in this file.  #TRUE to "call" them insteadgosub showEUOMenu1gosub TM_CreateTabControl TabControl1 10 30 170 150 White WindowText %font_arial 8gosub TM_AddTab TabControl1 Fruit Fruit #TRUE ; #TRUE = hidden, #FALSE = visiblegosub TM_AddTab TabControl1 Vegies Vegies #FALSE TestFunctiongosub TM_AddTab TabControl1 FastFood FastFood #FALSEgosub TM_AddTab TabControl1 Planets Planets #FALSEgosub TM_AddToList TabControl1_Fruit bananna TAGgosub TM_AddToList TabControl1_Fruit apple TAGgosub TM_AddToList TabControl1_Fruit kiwi TAGgosub TM_AddToList TabControl1_Fruit grapes TAGgosub TM_AddToList TabControl1_Vegies carrot TAGgosub TM_AddToList TabControl1_Vegies onions TAGgosub TM_AddToList TabControl1_Vegies tomato TAGgosub TM_AddToList TabControl1_FastFood Windys TAGgosub TM_AddToList TabControl1_FastFood Burger , #SPC , King TAGgosub TM_AddToList TabControl1_FastFood Carls , #SPC , Jr. TAGgosub TM_AddToList TabControl1_Planets Marsgosub TM_AddToList TabControl1_Planets Uranusgosub TM_AddToList TabControl1_Planets Neptunegosub TM_AddToList TabControl1_Planets Jupiter gosub TM_CreateTabControl TabControl2 200 30 170 150 White WindowText %font_arial 8gosub TM_AddTab TabControl2 Tab1 Tab1 #FALSEgosub TM_AddTab TabControl2 Tab2 Tab2 #FALSEgosub TM_AddTab TabControl2 Tab3 Tab3 #FALSEgosub TM_AddTab TabControl2 Tab4 Tab4 #FALSE gosub TM_CreateTabControl TabControl3 30 220 150 150 White WindowText %font_arial 8gosub TM_AddTab TabControl3 Tab1 Tab1 #FALSEgosub TM_AddTab TabControl3 Tab2 Tab2 #FALSEgosub TM_AddTab TabControl3 Tab3 Tab3 #FALSEgosub TM_AddTab TabControl3 Tab4 Tab4 #FALSE ; Lists are addressed as TabControl4_Tab1, 2, 3, 4gosub TM_CreateTabControl TabControl4 200 220 150 150 White WindowText %font_arial 8gosub TM_AddTab TabControl4 Tab1 Tab1 #FALSEgosub TM_AddTab TabControl4 Tab2 Tab2 #FALSEgosub TM_AddTab TabControl4 Tab3 Tab3 #FALSEgosub TM_AddTab TabControl4 Tab4 Tab4 #FALSE gosub TM_HideTabControl TabControl3 ; hide the whole tab controlgosub TM_ShowTabControl TabControl3 ; show the whole tab control, remembers what tabs where hidden gosub TM_HideTabByName TabControl1 Planetsgosub TM_ShowTabByName TabControl1 Fruit gosub TM_CopyAllItemsInList TabControl1_Planets TabControl2_Tab2 #FALSE #FALSEgosub TM_CopyAllItemsInList TabControl1_Planets TabControl3_Tab3 #FALSE #FALSEgosub TM_CopyAllItemsInList TabControl1_Planets TabControl4_Tab4 #FALSE #FALSE gosub TM_SelectTabByName TabControl2 Tab2gosub TM_SelectTabByName TabControl3 Tab3 repeat  gosub TM_HandleTabs TabControl1  gosub TM_HandleTabs TabControl2  gosub TM_HandleTabs TabControl3  gosub TM_HandleTabs TabControl4until #FALSE sub TestFunction  display ok Function Called!returnstop;  <------ End of test code 
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.

Scrripty:
You are a steely eyed missle man.  NEW TOYS! :)  Merry Christmas to Twinkle McNugget!

TrailMyx:

--- Quote from: Twinkle McNugget on March 12, 2010, 10:07:00 PM ---You are a steely eyed missle man.  NEW TOYS! :)  Merry Christmas to Twinkle McNugget!


--- End quote ---

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.

TrailMyx:
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.

Scrripty:

--- Quote from: TrailMyx on March 12, 2010, 10:38:19 PM ---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.

--- End quote ---

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

Navigation

[0] Message Index

[#] Next page

Go to full version