|
-
May 19th, 2002, 03:04 PM
#1
Thread Starter
Hyperactive Member
Menus at Runtime????
i am making a web browser, and i am attempting to construct a favourites type list. I have a form with a textbox on it and a command button, when the user types in a fave URL into the txt box and clicks the button, what i want to happen is that URL gets added to a menu at runtime.
Get what i am saying?
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 19th, 2002, 03:05 PM
#2
Hyperactive Member
Create a blank menu and set visible to false, set the index property to 0 and then at runtime you can use the load statement and set the properties. ie.
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
-
May 19th, 2002, 03:09 PM
#3
Thread Starter
Hyperactive Member
Hmmm i ahve a menu already setup, so the user can add a fave site whenever they want to, maybe the fave list can be saved to a text file?
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 19th, 2002, 03:13 PM
#4
Hyperactive Member
Sounds like a good idea
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
-
May 19th, 2002, 03:21 PM
#5
Thread Starter
Hyperactive Member
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 19th, 2002, 03:32 PM
#6
Hyperactive Member
You can open a text file to append line by line with:
Code:
dim intX as integer
intX = freefile 'tells you the next free file handle
open "Path" For Append As #intX
Print #intX, URL_Info_To_Add
close #intx
Then comes the reading bit:
Code:
dim intx as integer
intx = freefile
open "Path" For Input as #intX
Input #filenumber, Variable_To_Hold_Data
close #intX
Then you'd need some string manipulation to get the URL's out of the text file. I tend to use the split function to get the data into an array of values and loop thru them.
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
-
May 19th, 2002, 03:40 PM
#7
Thread Starter
Hyperactive Member
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 19th, 2002, 04:00 PM
#8
Hyperactive Member
OK.......... each time they add to faves you'll want to save the details in the text file with the following type of code and add to the menu with the load statement:
Code:
dim intX as integer
intX = freefile 'tells you the next free file handle
open "Path" For Append As #intX
Print #intX, URL_Info_To_Add
close #intx
then when your app loads you'd use the other code to load the text file to memory and then using string manipulation pull out the page title and the url and create your menus. I'm off home now post back a specific questions and i'll answer them when i get in about an hour.
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
-
May 20th, 2002, 03:32 AM
#9
Thread Starter
Hyperactive Member
i get what u mean, but i have no idea on how to do this : -
then when your app loads you'd use the other code to load the text file to memory and then using string manipulation pull out the page title and the url and create your menus. I'm off home now post back a specific questions and i'll answer them when i get in about an hour.
i am a newby programmer need a little help
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 20th, 2002, 04:17 AM
#10
Thread Starter
Hyperactive Member
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
May 20th, 2002, 04:47 AM
#11
use Ubound
Let's take, that you have a menu, called "Favorites", and you want to add items to it:
First, you'll have to find the next free index, and then load new menu item; then assign the text1.text as a caption to that menu.
load mnuFavorites(mnuFavorites.UBound+1)
mnuFavorites(mnuFavorites.UBound+1).Caption = text1.text
For responding to the click event, you can use the index of the new menu items.
Try it
-
May 20th, 2002, 10:38 AM
#12
Hyperactive Member
I think it's getting the data from the file that's the prob rather than creating the menu's at runtime. On the form's load event you need to read from the text file:
Code:
private sub form_load
dim intX as integer
dim intY as integer 'keep count of the menu items
dim strTemp as string
intx = freefile
intY = 1 'as the menu there is already 0
open "PATH" for input as #intx
do until eof(intx) 'checks for the end of the text file.
input #intx, strTemp 'reads line by line of the text file
load mnuFav(intY)
mnuFav(intY).caption = strtemp
loop
close #intX
end sub
See ya later,
-=XQ=-
"Reality is merely an illusion, albeit a very persistent one. "
- Albert Einstein (1879-1955)
This is the coolest site ever!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|