forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


History Menus and SSMenu.dll

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sun Mar 02, 2003 9:42 pm    Post subject: History Menus and SSMenu.dll Reply with quote

Here is a sample script that shows how to use SSmenu.dll to manage a
histroy menu.

I don't know for sure, but I think this script will work for VDS 3 as well.

Code:


rem     This sample script shows how to use SSMenu.dll for the handling of
rem     a history menu. The history items are stored in an INIFILE. As far as I
rem     can tell there is only one downfall to this method. If there isn't at least
rem     one existing history item to add to the first menu that will contain the
rem     history items, the menu will not be created, SSMenu.dll will not be able
rem     to get a handle for the history menu and when you refresh the history
rem     menu the newly added menu will not hide like it is supposed to and it
rem     will not be inserted in it's appropriate place in the File menu.

  external @path(%0)ssmenu.dll
 
rem     For this example, and because when you try this script out for the first time,
rem     you wont have the "HistTest.ini" file on your system, I've added this routine
rem     to generate the inifile for you. It should only generate it the first time you run
rem     the script.
  if @not(@file(@path(%0)HistTest.ini,z))
    list create,1
    list add,1,[History]
    list add,1,File0=History Item 1
    list add,1,File1=History Item 2
    list add,1,File2=History Item 3
    list add,1,File3=History Item 4
    list add,1,File4=History Item 5
    list add,1,File5=History Item 6
    list add,1,File6=History Item 7
    list add,1,File7=History Item 8
    list savefile,1,@path(%0)HistTest.ini
    list close,1
  end
 
rem     Now we'll open the newly generated or existing HistTest.ini file.
  inifile open,@path(%0)HistTest.ini
rem     And fill the %F variable with the first history item. For this example, this
rem     variable is only used in the :Refresh and :RefreshBUTTON sections.
  %F = @iniread(History,File0)
   
rem     Now let's load the history menu
 gosub Load
   
rem     And create the dialog window
  dialog create,HistTest,-1,0,360,200,CLASS HistTest
  dialog add,MENU,&File,&New|Ctrl+N,&Open|Ctrl+O,&Save|Ctrl+S,-,&Print|Ctrl+P,-,-,E&xit|Alt+X
  dialog add,MENU,Histry,@item(1,0),@item(1,1),@item(1,2),@item(1,3),@item(1,4),@item(1,5),@item(1,6),@item(1,7)
  menu class,HistTest
  %%menu = @menu(menubarId)
  %%fileMenu = @menu(getSubMenu,%%menu,0)
  %%historyMenu = @menu(hideMenu,%%menu,1)
  menu insertMenu,%%fileMenu,%%historyMenu,6,&History
  dialog add,BUTTON,Refresh,10,10,65,25
  dialog show
 
  list close,1
 
:Evloop
  wait event
  goto @event()
 
:NewMENU
:OpenMENU
:SaveMENU
:PrintMENU
  goto Evloop
 
:RefreshBUTTON
rem     We'll use the @input() function to add a new item to the history menu.
  %F = @input(New history item,%F)
  gosub Refresh
  goto Evloop
 
:ExitMENU
:CLOSE
  exit
 
:Load
  list create,1
  %x = 0
  repeat
    list add,1,@iniread(History,File%x)
    %x = @succ(%x)
  until @equal(%x,8)
  exit
 
:Refresh
  %x = 7
  if @not(@equal(@iniread(History,File0),%F))
    repeat
      inifile write,History,File%x,@iniread(History,File@pred(%x))
      %x = @pred(%x)
    until @equal(%x,0)
    inifile write,History,File%x,%F
    gosub Load
    menu destroy,%%historyMenu
    dialog add,MENU,Histry,@item(1,0),@item(1,1),@item(1,2),@item(1,3),@item(1,4),@item(1,5),@item(1,6),@item(1,7)
    %%historyMenu = @menu(hideMenu,%%menu,1)
    list close,1
  end
  exit


_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group