MondoNuovo Valued Newbie
Joined: 09 Jul 2001 Posts: 44 Location: Italy
|
Posted: Sat Mar 16, 2002 12:43 pm Post subject: Help: REPEAT ... @UNTIL |
|
|
I am creating a little program, but I have a problem with the command REPEAT... @UNTIL.
The command must create all the DIALOG specified in %% LAST.
I do not know this command good, you can help me?
| Code: |
rem You create a .INI file with this structure:
rem [Setting]
rem Last=1
rem
rem [Note 1]
rem Top=0
rem Left=20
rem Width=200
rem Height=140
rem Caption=Welcome
rem Text=Welcome to StickyNote
rem
rem You save the file with this name: INIFILE.INI
inifile open,@curdir()\inifile.ini
%%last = @iniread(Setting,Last)
Title StickyNote
DIALOG CREATE,StickyNote,0,0,0,0
DIALOG ADD,TASKICON,TASK,icon.ico,StickyNote
gosub Load_Note
:Evloop
wait event
goto @event()
:taskClick
if @equal(@click(B), RIGHT)
dialog popup,New Note|-|Exit
end
goto evloop
:close
:ExitMenu
exit
:text_noteclick
if @equal(@click(B), RIGHT)
dialog popup,New Note|Hide|Delete
end
goto evloop
:HideMenu
goto evloop
:DeleteMenu
goto evloop
:New NoteMenu
inifile open,@curdir()\inifile.ini
%%last = @iniread(Setting,Last)
DIALOG CREATE,New Post-It,-1,0,276,136,NOMIN
DIALOG ADD,EDIT,caption,14,2,180,19,Title
DIALOG ADD,TEXT,TEXT1,0,3,,,Caption:
DIALOG ADD,EDIT,edit_note,48,2,180,84,Text here
DIALOG ADD,BUTTON,OK,11,191,80,25,&OK,default
DIALOG ADD,BUTTON,Cancel,48,191,80,25,Cancel
DIALOG SHOW
goto evloop
:CancelBUTTON
dialog close
wait event
%e = @event()
goto evloop
:OKBUTTON
%%caption = @dlgtext(caption)
%%text_note = @dlgtext(edit_note)
if @null(@dlgtext(edit_note))@null(@dlgtext(caption))
goto evloop
else
%%num_note = @sum(%%last,1)
%%top = @iniread(Note %%last,Top)
%%left = @iniread(Note %%last,Left)
%%top1 = @sum(%%top,20)
%%left1 = @sum(%%left,10)
inifile write,Setting,Last,%%num_note
inifile write,Note %%num_note,Top,%%top1
inifile write,Note %%num_note,Left,%%left1
inifile write,Note %%num_note,Width,200
inifile write,Note %%num_note,Height,140
inifile write,Note %%num_note,Caption,%%caption
inifile write,Note %%num_note,Text,%%text_note
dialog close
wait event
%e = @event()
gosub ADD
end
goto evloop
:ADD
DIALOG CREATE,%%caption,%%top1,%%left1,200,140,smallcap,resizable,nosys
DIALOG ADD,STYLE,STYLE2,Arial,10,,YELLOW,FOREGROUND
DIALOG ADD,STYLE,STYLE1,Arial,8,,YELLOW,YELLOW
DIALOG ADD,TEXT,background,0,0,200,140,,STYLE1
DIALOG ADD,TEXT,text_note,5,5,190,130,%%text_note,STYLE2,click
DIALOG SHOW
exit
:LOAD_NOTE
if @equal(%%last,1)
gosub first
else
inifile open,@curdir()\inifile.ini
%%caption = @iniread(Note %%last,Caption)
%%text_note = @iniread(Note %%last,Text)
%%top = @iniread(Note %%last,Top)
%%left = @iniread(Note %%last,Left)
%%width = @iniread(Note %%last,Width)
%%height = @iniread(Note %%last,Height)
repeat
%%n_note = @pred(%%last)
inifile open,@curdir()\inifile.ini
%%caption = @iniread(Note %%n_note,Caption)
%%text_note = @iniread(Note %%n_note,Text)
%%top = @iniread(Note %%n_note,Top)
%%left = @iniread(Note %%n_note,Left)
%%width = @iniread(Note %%n_note,Width)
%%height = @iniread(Note %%n_note,Height)
dialog create,%%caption,%%top,%%left,%%width,%%height,smallcap,resizable,nosys
DIALOG ADD,STYLE,STYLE2,Arial,10,,YELLOW,FOREGROUND
DIALOG ADD,STYLE,STYLE1,Arial,8,,YELLOW,YELLOW
DIALOG ADD,TEXT,background,0,0,200,140,,STYLE1
DIALOG ADD,TEXT,text_note,5,5,190,130,%%text_note,STYLE2,click
DIALOG SHOW
until @equal(%%n_note,1)
:resize
PARSE "%H;%W",@dlgpos(,HW)
DIALOG SETPOS,background,0,0,@diff(%W,0),@diff(%H,%%dh)
DIALOG SETPOS,text_note,5,5,@diff(%W,5),@diff(%H,%%dh)
goto evloop
end
exit
:FIRST
inifile open,@curdir()\inifile.ini
%%caption = @iniread(Note %%last,Caption)
%%text_note = @iniread(Note %%last,Text)
%%top = @iniread(Note %%last,Top)
%%left = @iniread(Note %%last,Left)
%%width = @iniread(Note %%last,Width)
%%height = @iniread(Note %%last,Height)
dialog create,%%caption,%%top,%%left,%%width,%%height,smallcap,resizable,nosys
DIALOG ADD,STYLE,STYLE2,Arial,10,,YELLOW,FOREGROUND
DIALOG ADD,STYLE,STYLE1,Arial,8,,YELLOW,YELLOW
DIALOG ADD,TEXT,background,0,0,200,140,,STYLE1
DIALOG ADD,TEXT,text_note,5,5,190,130,%%text_note,STYLE2,click
DIALOG SHOW
:resize
PARSE "%H;%W",@dlgpos(,HW)
DIALOG SETPOS,background,0,0,@diff(%W,0),@diff(%H,%%dh)
DIALOG SETPOS,text_note,5,5,@diff(%W,5),@diff(%H,%%dh)
exit
|
Thanks in advance
Daniele |
|