Jump to content

Tab Menus Created From Array


Recommended Posts

GUICreate("System Information", 900, 600)

GUICtrlCreateTab(10,10,850,20)

;Create System Tabs

Dim $tabArray, $tabItem

$tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]

For $i = 1 To $tabArray[0] Step 1

$tabItem[$i] = GUICtrlCreateTabItem($tabArray[$i])

Next

For each of the $tabArray Items im trying to create a tab item, trying to keep my code short and i though this might be a good approach but i am getting

Error: Subscript used with non-Array variable

on the line $tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]

where am i going wrong at?

Edited by shawnmstout
Link to comment
Share on other sites

You have to edit the next part of your code:

;Create System Tabs
Dim $tabItem, $tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]
For $i = 1 To $tabArray[0] Step 1

You have to use Dim when you are going to use [ , , ] with an array

Edited by PAULOGARCIA2005
Link to comment
Share on other sites

STOP BUMPING YOUR POSTS !! Your code is only important to you and these forums are "staffed" by volunteers only and said volunteers have their own lives to live and code to write. We can't sit here anxiously awaiting your next question, the answer to which can usually be found by reading the help file and/or searching the forums.

GUICreate("System Information", 900, 600)
GUICtrlCreateTab(10,10,850,20)
;Create System Tabs
Dim $tabArray, $tabItem
$tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]
For $i = 0 To Ubound($tabArray) -1
  GUICtrlCreateTabItem($tabArray[$i])
Next

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

STOP BUMPING YOUR POSTS !! Your code is only important to you and these forums are "staffed" by volunteers only and said volunteers have their own lives to live and code to write. We can't sit here anxiously awaiting your next question, the answer to which can usually be found by reading the help file and/or searching the forums.

GUICreate("System Information", 900, 600)
 GUICtrlCreateTab(10,10,850,20)
 ;Create System Tabs
 Dim $tabArray, $tabItem
 $tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]
 For $i = 0 To Ubound($tabArray) -1
   GUICtrlCreateTabItem($tabArray[$i])
 Next

you dont think i searched before i asked?

well i did

Link to comment
Share on other sites

I was complaining about your bumping posts after being warned earlier today. The norm is 24 hours as mentioned in my signature, which I also pointed you to in this post

http://www.autoitscript.com/forum/index.php?showtopic=98924&view=findpost&p=711010

People who do that too often will frequently find themselves taking a holiday from the forums so they have time to research and consider proper forum ettiquette.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Use GUISetState()

And more code because the GUI is created, and is show with GUISetState() and then close because there isn't more code.

And something else: USE KODA!

Thanks Paul for responding,

if you look at line 38 i am using GUISetState(@SW_SHOW) <---tried with and without the @SW_SHOW

as for koda, thats what i started with, but i wanted to create the tabs from an array instead of the manually entering all the lines, this file will get huge if i do it that way, so im trying to save space

i found out why it kept disappearing, i left out

While 1

$msg = GUIGetMsg()

Switch $msg

Case $msg = 0

ContinueLoop

EndSwitch

WEnd

No Tabs are showing yet, attached is the updated code

functionsSystemInfo.au3

Link to comment
Share on other sites

I was complaining about your bumping posts after being warned earlier today. The norm is 24 hours as mentioned in my signature, which I also pointed you to in this post

#711010

People who do that too often will frequently find themselves taking a holiday from the forums so they have time to research and consider proper forum ettiquette.

i must of overlooked about the bumping issue

i looked back at the link you gave me and you did mention it, sorry about that

either way i apologize, ill give the recommended amount of time before bumping the post

Edited by shawnmstout
Link to comment
Share on other sites

KODA Code is erroring out, i duplicated everything but the menu items

says $GUI_DOCKWIDTH <= Error: Variable used without being declared

says $GUI_DOCKHEIGHT <= Error: Variable used without being declared

says $GUI_SHOW <= Error: Variable used without being declared

my question is, with the generated code, what was this supposed to be or do i simply dim it?

Below is the updated code with dim'ing the variables, still no tabs

functionsSystemInfo.au3

Link to comment
Share on other sites

This is working fine

;
GUICreate("System Information", 900, 600)
 GUICtrlCreateTab(10,10,850,20)
 ;Create System Tabs
 Local $tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]
 For $i = 0 To Ubound($tabArray) -1
   GUICtrlCreateTabItem($tabArray[$i])
 Next
GUISetState()
While 1
   If GUIGetMsg() = -3 Then exit
Wend
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

This is working fine

;
 GUICreate("System Information", 900, 600)
  GUICtrlCreateTab(10,10,850,20)
  ;Create System Tabs
  Local $tabArray[7] = ["Hard Drive", "Bios", "Services", "Running Processes", "Display", "System", "Print"]
  For $i = 0 To Ubound($tabArray) -1
    GUICtrlCreateTabItem($tabArray[$i])
  Next
 GUISetState()
 While 1
    If GUIGetMsg() = -3 Then exit
 Wend
 ;

WORKS!!!!!! thanks GeoSoft only problem is setting up a variable for each Tabitem, is it possible of doing something like that? Edited by shawnmstout
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...