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 


Full Checkbox List Routines - Commented
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sat Dec 21, 2002 7:19 pm    Post subject: Full Checkbox List Routines - Commented Reply with quote

__________________________________________________________________________________________________________________________
All the actual code is free. The GUI of the interface belongs to William Smith, please do not make an exact replica or attempt to reproduce the actual program utility we are developing, which is difficult to figure out exactly what it is anyway.

Code:

REM Check List Routines by NodNarb based on script "Checkbox List" posted by FreezingFire (http://www.vdsworld.com/forum/viewtopic.php?t=599). 

REM Free to use as long as above is kept in tact before routine begins.

rem Actual GUI for this specific interface is property of William Smith (Clearwater, FL) and may not be replicated. Code within belongs to Brandon Cunningham and may be used without limits.

REM Known Issues:  Checkboxes do not update until scrollbar released.
REM This script works best when ran, not when debugged; this is due to dumping of checkbox events in some routines.

rem Incomplete dialog, buttons not coded.  Goto evloop if one clicked.
option decimalsep,.

rem Check for large fonts, scale appropriately
if @equal(@sysinfo(PIXPERIN),120)
option scale,97
else
option scale,96
end

option errortrap,evloop
rem must specify a inifile for this technique to work.
inifile open,@path(%0)attributes.ini

rem dialog creation

REM hide Billy's work
  DIALOG CREATE,Area Attributes,-1,0,225,417
    REM DIALOG CREATE,Area Attributes,-1,0,425,417

  DIALOG ADD,STYLE,STYLE2,,8,B,WHITE,FOREGROUND
  REM rem below was the prototype bitmap from my partner.  Had to mask over it with proper elements specified in bitmap, not needed for this project
rem DIALOG ADD,BITMAP,BITMAP1,0,0,418,424,C:\Windows\Desktop\area attributes.bmp
DIALOG ADD,STYLE,STYLE1,0,,,BLACK,FOREGROUND
  DIALOG ADD,GROUP,GROUP1,1,231,177,240,Add Attribute
  DIALOG ADD,GROUP,GROUP2,250,232,177,144,Remove Attribute
  DIALOG ADD,LIST,LIST1,0,0,224,394,,STYLE2,click
  DIALOG ADD,COMBO,COMBO1,25,240,160,21,COMBO1
  DIALOG ADD,CHECK,CHECK1,56,240,160,18,Add to this room only
  DIALOG ADD,CHECK,CHECK2,80,240,160,18,Create attribute template
  DIALOG ADD,CHECK,CHECK3,104,240,160,18,Add to template
  DIALOG ADD,CHECK,CHECK4,129,240,160,18,Add to entire map
  DIALOG ADD,RADIO,RADIO1,160,233,173,52,Set all added attributes as:,Enabled (Yes)|Disabled (No)
  DIALOG ADD,BUTTON,BUTTON1,216,239,162,18,Add Requested Attribute(s)
  DIALOG ADD,COMBO,COMBO2,265,240,160,,COMBO2
  DIALOG ADD,CHECK,CHECK5,297,240,160,18,Remove from this room
  DIALOG ADD,CHECK,CHECK6,321,240,160,18,Remove from entire map
  DIALOG ADD,CHECK,CHECK7,345,240,160,,Create removal template
  DIALOG ADD,BUTTON,BUTTON2,369,240,160,18,Remove Requested Attributes
  DIALOG ADD,TEXT,TEXT1,153,240,160,1,TEXT1,,STYLE1
  DIALOG ADD,STATUS,STATUS1,STATUS1
DIALOG ADD,CHECK,lCHECK0,2,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK1,15,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK2,28,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK3,41,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK4,54,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK5,67,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK6,80,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK7,93,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK8,106,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK9,119,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK10,132,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK11,145,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK12,158,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK13,171,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK14,184,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK15,197,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK16,210,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK17,223,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK18,236,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK19,249,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK20,262,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK21,275,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK22,288,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK23,301,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK24,314,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK25,327,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK26,340,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK27,353,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK28,366,190,13,13,,,click
DIALOG ADD,CHECK,lCHECK29,379,190,13,13,,,click
  list add,list1,Sunlight
  list add,list1,Air
  list add,list1,Underground
  repeat
rem create enough items for example
  %%bcount = @succ(%%bcount)
  list add,list1,blah%%bcount
  until @equal(%%bcount,200)
gosub hidechecks
  DIALOG SHOW

:timer
%%check = 0
rem %A grabs the lowest VISIBLE index
%A = @sendmsg(@win(~LIST1),$018E,0,0)
repeat
rem %B grabs the string item in list1 at index %A w/o actually selecting it.
%B = @sendmsg(@win(~LIST1),$0189,%A,@STRBUF())
rem Have to increment the list index to grab the right string item to match the checkbox...similar to list seek.
%A = @succ(%A)
dialog set,lcheck%%check,@iniread(attributes,%B)
rem Dump the lcheck%%check event else will cause infinite loop
%%event = @event()
%%check = @succ(%%check)
until @equal(%%check,30)

rem just in case items added/deleted
gosub hidechecks


:evloop
wait event,1
goto @event()

:close
exit
   
   :hidechecks
   rem If the list has enough items to sustain all checks, goto evloop
   rem Set the %%bcount variable to 10 to see this work.
   %%until = @count(list1)
   if @greater(%%until,29)
   exit
   else
   end
    rem Hide uneeded checks.
   %%count = 30
   repeat
   %%count = @pred(%%count)
   dialog hide,lcheck%%count
   until @equal(%%until,%%count)
   exit
   
   :list1click
    rem Grab the right checkbox corrosponding to list item.
   %A = @sendmsg(@win(~LIST1),$018E,0,0)
    %%check = @diff(@index(list1),%A)
   
   rem Toggle checkbox with list click, kind of optional, but I like it.
   if @equal(@iniread(attributes,@item(list1)),1)
dialog clear,lcheck%%check
   else
   dialog set,lcheck%%check,1
   end
   %%event = @event()
   rem Save the state of the check.
   inifile write,attributes,@item(list1),@dlgtext(lcheck%%check)
   goto evloop
   
   REM BELOW ALL GOES TO BOTTOM PROCESSCHECK ROUTINE AFTER SPECIFYING CHECK NUMBER
   
   rem Note:  Quotations around numerals where necessary for compatiblity with a mimick tool, not actually needed.
   
:lcheck0click
%%checknum = "0"
gosub processcheck
goto evloop

:lcheck1click
%%checknum = "1"
gosub processcheck
goto evloop

:lcheck2click
%%checknum = "2"
gosub processcheck
goto evloop

:lcheck3click
%%checknum = "3"
gosub processcheck
goto evloop

:lcheck4click
%%checknum = "4"
gosub processcheck
goto evloop

:lcheck5click
%%checknum = "5"
gosub processcheck
goto evloop

:lcheck6click
%%checknum = "6"
gosub processcheck
goto evloop

:lcheck7click
%%checknum = "7"
gosub processcheck
goto evloop

:lcheck8click
%%checknum = "8"
gosub processcheck
goto evloop

:lcheck9click
%%checknum = "9"
gosub processcheck
goto evloop

:lcheck10click
%%checknum = "10"
gosub processcheck
goto evloop

:lcheck11click
%%checknum = "11"
gosub processcheck
goto evloop

:lcheck12click
%%checknum = "12"
gosub processcheck
goto evloop

:lcheck13click
%%checknum = "13"
gosub processcheck
goto evloop

:lcheck14click
%%checknum = "14"
gosub processcheck
goto evloop

:lcheck15click
%%checknum = "15"
gosub processcheck
goto evloop

:lcheck16click
%%checknum = "16"
gosub processcheck
goto evloop

:lcheck17click
%%checknum = "17"
gosub processcheck
goto evloop

:lcheck18click
%%checknum = "18"
gosub processcheck
goto evloop

:lcheck19click
%%checknum = "19"
gosub processcheck
goto evloop

:lcheck20click
%%checknum = "20"
gosub processcheck
goto evloop

:lcheck21click
%%checknum = "21"
gosub processcheck
goto evloop

:lcheck22click
%%checknum = "22"
gosub processcheck
goto evloop

:lcheck23click
%%checknum = "23"
gosub processcheck
goto evloop

:lcheck24click
%%checknum = "24"
gosub processcheck
goto evloop

:lcheck25click
%%checknum = "25"
gosub processcheck
goto evloop

:lcheck26click
%%checknum = "26"
gosub processcheck
goto evloop

:lcheck27click
%%checknum = "27"
gosub processcheck
goto evloop

:lcheck28click
%%checknum = "28"
gosub processcheck
goto evloop

:lcheck29click
%%checknum = "29"
gosub processcheck
goto evloop


   
:processcheck
REM Get topmost visible index of list1
   %A = @sendmsg(@win(~LIST1),$018E,0,0)
   rem Seek corresponding list item to checkbox action
list seek,list1,@sum(%a,%%checknum)
rem Set the check state
    if @equal(@iniread(attributes,@item(list1)),1)
dialog clear,lcheck%%checknum
   else
dialog set,lcheck%%checknum,1
   end
   rem Dump the check event lcheck%%checknum
   %%event = @event()
   rem Save the state of the checkbox
inifile write,attributes,@item(list1),@dlgtext(lcheck%%checknum)
exit


Brandon "NodNarb" Cunningham


Last edited by cnodnarb on Sun Dec 22, 2002 8:25 pm; edited 5 times in total
Back to top
View user's profile Send private message AIM Address
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Dec 21, 2002 7:30 pm    Post subject: Reply with quote

Well, the idea is good, it looks good (!) but if I click on a list item, the checkbox is not always good. But I really like this one!

Btw. You should include option decimalsep,. in every script you make, because non-English system will give errors if not...
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Dec 21, 2002 8:39 pm    Post subject: Reply with quote

Looks good but like Skit said it doesn't seem to check and uncheck like it should all the time.
option scale,96 is another good idea as it wasn't all that pretty on my large fonts system Wink

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sat Dec 21, 2002 8:56 pm    Post subject: Reply with quote

Thanks for the tip on option scaling Wink Much appreciated! As far as the buggy behavior of check boxes...it is because of the dumped checkbox clicks during the timer routine...program works best when compiled (on a fast processor!), barely works at all when debugged.

Once again, thanx for the replies!

NodNarb

EDIT TO ABOVE CODE:
Changed timer from .1 to 1, helped with handling events, but now the checkboxes feel more detached from the list when its scrolled.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sat Dec 21, 2002 10:11 pm    Post subject: Option Scale Dilemma Reply with quote

I have a problem with option scaling with this script, when in small fonts needs to be 96, but when in large fonts needs to be 97.

Any suggestions?

NodNarb
Back to top
View user's profile Send private message AIM Address
ShinobiSoft
Professional Member
Professional Member


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

PostPosted: Sat Dec 21, 2002 10:15 pm    Post subject: Reply with quote

To the best of my knowledge, there is not 97. Option scaling is for pixels per inch.

Small Fonts = 96 pixels per inch ==
Code:
option scale,96

Large fonts = 120 pixels per inch ==
Code:
option scale,120

_________________
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
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Dec 21, 2002 10:28 pm    Post subject: Reply with quote

Yikes, 120 makes it way off on my system. Oddly enough, 98 looks best.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
ShinobiSoft
Professional Member
Professional Member


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

PostPosted: Sat Dec 21, 2002 10:33 pm    Post subject: Reply with quote

Hey cnodnarb,

To shorten the code a little couldn't you use a 'fall through' kind of approach for your check box labels?

Here's a very short example:
Code:

<Program code here>
.
.
.

:lcheck1CLICK
:lcheck2CLICK
:lcheck3CLICK
:lchck4CLICK
:lcheck5CLICK
  %%checksum = @substr(%E,7,-5)
  gosub processcheck
  goto Evloop

rem You could even fall through to the processcheck and loose
rem the gosub and goto commands all together.
rem If you do fall through completelt, remember to change the exit
rem command at the end of the processcheck label to a goto Evloop!

:processcheck
.
.
.




Just an idea!

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."


Last edited by ShinobiSoft on Sat Dec 21, 2002 10:41 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
ShinobiSoft
Professional Member
Professional Member


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

PostPosted: Sat Dec 21, 2002 10:34 pm    Post subject: Reply with quote

Apparently I stand corrected about option scaling. Shocked
_________________
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
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sat Dec 21, 2002 11:15 pm    Post subject: Reply with quote

Thanx for the info bweckel! I can use @sysinfo(pixperin) to check for Large Fonts!

As far as looping goes...it does shorten down code. I agree...but I prefer not to do that. I like to be able to easily find my sections of code, and this style makes 'em stick out like a sore thumb. As far as speed of producing a loop over typing all of it out, i've found a third option. I use a mimick tool where I can insert $ signs as numbers and give it a range (1-100).

Granted this does increase the file size a bit...but I think just about everybodies HD's can handle it.

It's all about preference Wink

NodNarb
Back to top
View user's profile Send private message AIM Address
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 737
Location: The Netherlands

PostPosted: Sun Dec 22, 2002 2:11 pm    Post subject: Reply with quote

NodNarb,

You must replace the following lines of code you put:

Code:

if @equal(@sysinfo(PIXPERIN),120)
option scale,97
else
option scale,96
end



with:

Code:

option scale,<the value returned by @sysinfo(pixperin) on the system on which the dialog was designed (YOUR SYSTEM)>



The "OPTION SCALE" value should not be dynamically determined on the end user's systems.

Tommy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sun Dec 22, 2002 8:11 pm    Post subject: Reply with quote

Must is a strong word Tommy!

Have a look at it in Large Fonts under "option scale,96" vs "option scale,97" on your system and tell me which one makes the checks line up better with the list. There's always an exception to a rule Wink

NodNarb
Back to top
View user's profile Send private message AIM Address
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sun Dec 22, 2002 9:02 pm    Post subject: Reply with quote

Tommy is right. It should be scaled to what pixperinch returns on the programmers system. That way it shows pretty much the same on others systems as it does on the programmers.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sun Dec 22, 2002 9:05 pm    Post subject: Reply with quote

Embarassed THIS POST IS INCORRECT Embarassed

See post below for details.

In reference to a utility I made:

I must say that using option scaling is not always a good ideal for large fonts systems. It the case of the code below (sorry no bitbtn images available) it actually causes the scrollbars on the dialog to become completely unviewable, to where as with no option scale set they are still usable, although not in full view. Option scale 128 brought both scroll bars into view, but left a large margin on the right side of the dialog. I would actually have to check @sysinfo(pixperin) for large fonts and recode my resize event to make this compatible with both font settings (which I may well do).

Code:

list create,1
option skdelay,0
rem try both scale methods below and no scale at all to get my point using large fonts.
rem option scale,96
rem option scale,128
OPTION DECIMALSEP,"."
inifile open,@path(%0)codepad.ini
title Brandon's Codepad
%%filename = Untitled
  DIALOG CREATE,Untitled - Brandon's Codepad,-1,0,470,275,resizable,class bcode,dragdrop
  DIALOG ADD,STYLE,STYLE1,Comic Sans MS,10,B,WHITE,FOREGROUND
  DIALOG ADD,MENU,&File,&New|CTRL+N,&Open|CTRL+O,&Save|CTRL+S,Save &As,-,&Extensions
    dialog add,menu,&Edit,&Undo|CTRL+Z,-,Cu&t|CTRL+X,&Copy|CTRL+C,&Paste|CTRL+V,-,Select &All|CTRL+A,-,&Find|CTRL+F,Find &Next|F3
  dialog add,menu,&Macro|CTRL+M,&Run|CTRL+R
  dialog add,menu,&Help,&About
  DIALOG ADD,GROUP,GROUP2,0,196,3000,30
  DIALOG ADD,LIST,LIST1,54,50,180,144
  DIALOG ADD,LIST,LIST2,84,114,180,144
  DIALOG ADD,EDIT,EDIT1,32,-2,472,244,,style1,SCROLL,multi
  DIALOG ADD,GROUP,GROUP1,0,-10,208,30
  DIALOG ADD,BUTTON,BUTTON1,4,2,22,22
  DIALOG ADD,BITBTN,BITBTN1,6,4,18,18,codepad.dll|0,,New
  DIALOG ADD,BUTTON,BUTTON2,4,24,22,22,BUTTON2
  DIALOG ADD,BITBTN,BITBTN2,6,26,18,18,codepad.dll|1247,,Open
  DIALOG ADD,BUTTON,BUTTON3,4,46,22,22,BUTTON3
  DIALOG ADD,BITBTN,BITBTN3,6,48,18,18,codepad.dll|2500,,Save
  DIALOG ADD,BUTTON,BUTTON4,4,74,22,22,BUTTON4
  DIALOG ADD,BITBTN,BITBTN4,6,76,18,18,CODEPAD.DLL|3797,,Cut
  DIALOG ADD,BUTTON,BUTTON5,4,96,22,22,BUTTON5
  DIALOG ADD,BITBTN,BITBTN5,6,98,18,18,codepad.dll|5064,,Copy
  DIALOG ADD,BUTTON,BUTTON6,4,118,22,22,BUTTON6
  DIALOG ADD,BITBTN,BITBTN6,6,120,18,18,codepad.dll|6335,,Paste
  DIALOG ADD,BUTTON,BUTTON7,4,140,22,22,BUTTON7
  DIALOG ADD,BITBTN,BITBTN7,6,142,18,18,codepad.dll|7634,,Undo
  DIALOG ADD,BUTTON,BUTTON8,4,168,22,22,BUTTON8
  DIALOG ADD,BITBTN,BITBTN8,6,170,18,18,codepad.dll|8833,,Run
  DIALOG ADD,STATUS,STAT
    DIALOG ADD,TEXT,DummyTxt,0,0,,,"A",Style1
  %%charwidth = @dlgpos(DummyTxt,W)
  DIALOG REMOVE, DummyTxt
  DIALOG SHOW
if %1
%%filedlg = %1
goto openme
else
end
 
  :evloop
  %q = @winexists(~edit1)
  dialog title,%%filename - Brandon's Codepad
  wait .1
 
  %%eventdialog = @event(d)
 parse "%%event;%%dialog",%%eventdialog
 if %%Event
 dialog select,%%dialog
 goto %%event
 else
 end
 
 list clear,1
   
   %%stringn = @dlgtext(edit1)
  %%delim = " "
  %%pos = @pos(%%delim,%%stringn)
  if @greater(%%pos,0)

    rem If the string starts out with one or more delim chars, we need to trim it
    repeat
   %%pos = @pos(%%delim,%%stringn)
    if @equal(%%pos,1)
     %%stringn = @strdel(%%stringn,1,)
   end
   until @greater(%%pos,1)
    rem If the string ends with one or more delim chars, we need to trim it also
    repeat
    if @equal(@substr(%%stringn,@len(%%stringn)),%%delim)
     %%stringn = @strdel(%%stringn,@len(%%stringn))
   end
   until @not(@equal(@substr(%%stringn,@len(%%stringn)),%%delim))

    repeat
        %%pos = @pos(%%delim,%%stringn)
        list add,1,@substr(%%stringn,1,@sum(%%pos,@pred(@len(%%delim))))
        %%stringn = @strdel(%%stringn,%%pos,@sum(%%pos,@pred(@len(%%delim))))
    until @equal(@pos(%%delim,%%stringn), 0)
  end
   
   
rem :TIMER
  rem -- Get line number (use %c to get a start point) --
  %c = @sendmsg(%q,$0BB,-1,0)
  %l = @succ(@sendmsg(%q,$0C9,%c,0))

  rem -- Get total number of lines in document --
  %n = @sendmsg(%q,$0BA,0,0)

  rem -- Get character position in edit line (complicated) --
  %c = @mod(@sendmsg(%q,$0B0,0,0),65536)
  rem =================================================================
    rem -- This continously gives the column count before the cursor,
    rem -- but it also increments the previous line's column count on
    rem -- a new line until a char has been entered on that new line.
    rem %c = @pred(%c)
  rem =================================================================
  %c = @mod(@sendmsg(%q,214,%c,0),65536)
  if @greater(0,%c)
     %c = @sum(%c,65536)
  end
  if @greater(%c,32768)
     %c = @diff(%c,65536)
  end
  %z = @mod(@sendmsg(%q,214,0,0),65536)
  if @greater(0,%z)
     %z = @sum(%z,65536)
  end
  if @greater(%z,32768)
     %z = @diff(%z,65536)
  end
  %c = @succ(@div(@diff(%c,%z),%%charwidth))

  rem -- Check if document has been modified --
  if @zero(@sendmsg(%q,$0B8,0,0))
     %m = ""
  else
     %m = Modified
  end
rem    DIALOG SET, Stat, "Line " %l" of "%n" lines     Col "%c"     "%m"     "@len(@dlgtext(Edit1))" bytes"
  DIALOG SET, Stat, "Line " %l" of "%n" lines       "%m"     "@len(@dlgtext(Edit1))" bytes"        @succ(@count(1)) "words"
  goto evloop 

:dragdrop
list clear,list2
list dropfiles,list2
list seek,list2,0
%%filedlg = @item(list2)
goto openme
 
  :close
  if @equal(%%comborun,true)
  dialog select,0
  exit
  else
  end
  if @equal(%m,Modified)
  gosub checkask
  else
  end
  exit

  :resize
  dialog hide,list1
  dialog hide,list2
  dialog focus,edit1
  parse "%t;%l;%w;%h",@winpos(#bcode,TLWH)
    dialog setpos,edit1,32,0,@diff(%w,8),@diff(%h,97)
  goto evloop
 
  :newmenu
  :button1button
  :bitbtn1button
  if @equal(%m,Modified)
  gosub checkask
  else
  end
  dialog clear,edit1
  list clear,list1
  %%filename = Untitled
  goto evloop
 
  :openmenu
  :button2button
  :bitbtn2button
  if @equal(%m,Modified)
  gosub checkask
  else
  end
  %%filedlg = @filedlg(@iniread(ext,ext))
:openme
  if %%filedlg
  %%file = %%filedlg
  %%filename = @name(%%file)
  list loadfile,list1,%%filedlg
  dialog clear,edit1
  dialog set,edit1,@text(list1)
  else
  end
  goto evloop 

:savemenu
:button3button
:bitbtn3button
gosub save
goto evloop

:save
if @equal(%%filename,Untitled)
gosub save as
else
dialog set,list1,@dlgtext(edit1)
list savefile,list1,%%file
end
exit

:save asmenu
gosub save as
goto evloop

:save as
%%filedlg = @filedlg(@iniread(ext,ext),,,save)
if @null(%%filedlg)
exit
else
if @null(@ext(%%filedlg))
%%ext = @input(Please give this file an extension,.txt)
%%filedlg = %%filedlg""%%ext
else
end
%%file = %%filedlg
%%filename = @name(%%filedlg)
list clear,list1
dialog set,list1,@dlgtext(edit1)
list savefile,list1,%%filedlg
end
exit
 
  :cutmenu
  :button4button
  :bitbtn4button
  %a = @sendmsg(@win(~edit1),$300,0,0)
  goto evloop
 
  :copymenu
  :button5button
  :bitbtn5button
  %a = @sendmsg(@win(~edit1),$0301,0,0)
  goto evloop
 
  :pastemenu
  :button6button
  :bitbtn6button
  %a = @sendmsg(@win(~edit1),$0302,0,0)
  goto evloop
 
  :undomenu
  :button7button
  :bitbtn7button
  %a = @sendmsg(@win(~edit1),$0304,0,0)
  goto evloop
 
  :extensionsmenu
  %%input = @input(Edit Extensions,@iniread(ext,ext))
  inifile write,ext,ext,%%input
  goto evloop
 
  :checkask
rem  if @dlgtext(edit1)
  gosub asksave
rem  else
rem  end
  exit
   
  :asksave
  %%ask = @ask(Would you like to save this file?)
  if %%ask
  gosub yesasksave
  else
  end
  exit
  :yesasksave
  if @equal(%%filename,Untitled)
  gosub save as
  else
  gosub save
  end
  exit
 
  :runmenu
  :button8button
  :bitbtn8button
 
  if @null(@iniread(Macro,lastdir))
  directory change,@path(%0)Macros
  else
  directory change,@iniread(Macro,lastdir)
  end
 
    %%filedlg = @filedlg(*.*)
   inifile write,Macro,lastdir,@path(%%filedlg)
   if %%filedlg
   list clear,list2
   list loadfile,list2,%%filedlg
dialog disable,edit1
dialog enable,edit1
   dialog focus,edit1
   
   
   REM List Seek Header by NodNarb
   %%index = 0
   %%count = @count(list2)
   repeat
   
   list seek,list2,%%index
   
   %%string = @item(list2)
   
   if @equal(%%string,||)
   %%a = ""
   %%c = ""
   gosub sendwithvar
   else
   end
   
   

      parse "%%a;%%b;%%c",%%string


if @both(%%a,@equal(%%b,send))
gosub sendwithvar
else
end

if @both(%%a,@equal(%%b,Space))
gosub sendwithvar
else
end

if @both(%%a,@equal(%%b,NoSpace))
gosub sendwithvar
else
end

if @both(%%a,@equal(%%b,Quote))
gosub sendwithvar
else
end

if @both(%%a,@equal(%%b,Backspace))
gosub sendwithvar
else
end

   if @equal(%%b,Copy)
%a = @sendmsg(@win(~edit1),$0301,0,0)
   else
   end
   if @equal(%%b,Cut)
  %a = @sendmsg(@win(~edit1),$300,0,0)
   else
   end
   
   if @equal(%%b,Paste)
  %a = @sendmsg(@win(~edit1),$0302,0,0)
   else
   end
   
   if @equal(%%b,Undo)
     %a = @sendmsg(@win(~edit1),$0304,0,0)
     else
     end
      
   if @equal(%%b,Left)
   window send,@win(~edit1),@key(left)
   else
   end
   
   if @equal(%%b,Right)
   window send,@win(~edit1),@key(Right)
   else
   end
   
   if @equal(%%b,Del)
   window send,@win(~edit1),@key(Del)
   else
   end
   
   if @equal(%%b,Sp)
   window send,@win(~edit1),@chr(32)
   else
   end
   
   if @equal(%%b,Up)
   window send,@win(~edit1),@key(Up)
   else
   end
   
   if @equal(%%b,Down)
   window send,@win(~edit1),@key(Down)
   else
   end
   
   if @equal(%%ask,true)
   gosub askit
   else
   end
   
   if @equal(%%a,comboinput)
   %%comborun = true
   gosub comboinput
   %%comborun = false
   %%index = @succ(%%index)
   list seek,list2,%%index
   %%string = @item(list2)
   parse "%%a;%%b;%%c",%%string
   dialog select,0
   dialog focus,edit1
rem   gosub sendwithvar
   rem %%var = ""
   else
   end
   
   if %%c
   gosub sendwithvar
   %%var = ""
   else
   end
   
   if @both(%%b,@null(%%c))
   gosub setvar
   else
   end
   
   if @both(@null(%%b),@null(%%c))
   if @not(@equal(%%string,||))
   window send,@win(~edit1),%%string@cr()
   else
   end
   else
   end
      
   %%index = @succ(%%index)
   
   until @equal(%%index,%%count)
   
else
end   

goto evloop
   
  :FindMENU
  %t = @input(Enter text to search for:)
  if %t
     %s = @pred(@pos(%t,@dlgtext(Edit1)))
     if @greater(%s,-1)
        gosub SelectText
     else
        INFO Text not found @tab()
     end
  end
  goto EVLOOP

:Find NextMENU
  if %t
     %p = @pos(%t,@strdel(@dlgtext(Edit1),1,@succ(%s)))
     if @greater(%p,0)
        %s = @sum(%s,%p)
        gosub SelectText
     else
        INFO Text not found @tab()
     end
  end
  goto EVLOOP
 
  :SelectText
  rem -- Select text found --
  %z = @sendmsg(%q,$0B1,%s,@sum(%s,@len(%t)))
  rem -- Scroll selected text (caret) into view --
  %z = @sendmsg(%q,$0B7,0,0)
  exit
 
  :select allmenu
    DIALOG FOCUS, Edit1
  %z = @sendmsg(%q,$0B1,0,-1)
  goto EVLOOP
 
  :aboutmenu
 
  REM AboutDialog Visual DialogHeader by NodNarb (About Dialog)
  :aboutdialog
  window hide,about
  %w = Brandon's Codepad
  DIALOG CREATE,About %w,-1,,361,267,NOMIN,ontop,nosys
  DIALOG ADD,BITMAP,BITMAP1,6,10,32,32,%0
  DIALOG ADD,TEXT,TEXTa1,18,70,,,%w@cr()@cr()for Windows 95@cr()@cr()Copyright @chr(169)Brandon Cunningham@cr()@cr()@cr()GNU Public License@cr()@cr()Visit http://www.gnu.org/copyleft/gpl.html#SEC3 for details
  DIALOG ADD,BUTTON,BUTTON31,230,264,74,,OK,DEFAULT
  DIALOG ADD,RADIO,RADIO1,166,14,330,2
  DIALOG ADD,TEXT,TEXTa2,182,70,,,CNodNarb"@"aol.com
  DIALOG SHOWmodal
  wait event
  goto @event()
  REM End About Dialog Visual DialogHeader by NodNarb (Call for AboutBox)
 
  :button31button
  dialog select,0
  goto evloop
 
  :setvar
  if @equal(%%a,filedlg)
  %%var = @filedlg(%%b)
  else
  end
 
  if @equal(%%a,input)
  %%var = @input(%%b)
  else
  end
 
  if @equal(%%a,dirdlg)
  %%var = @filedlg(%%b)
  else
  end 
 
  %%ask = false
 
  if @equal(%%a,ask)
  %%var = @ask(%%b)
  if @null(%%var)
  %%index = @succ(%%index)
  else
  end
  else
  end
 
  exit

:comboinput
  DIALOG CREATE,Brandon's Codepad,-1,0,269,96,NOMIN
  DIALOG ADD,BUTTON,ComboBUTTON1,62,62,70,24,OK,Default
  DIALOG ADD,Button,Cancel,62,142,70,24,Cancel
  DIALOG ADD,COMBO,COMBO1,30,10,254,21
  DIALOG ADD,TEXT,TEXT1,8,12
  if @file(%%c)
  list loadfile,combo1,%%c
  else
  end
  dialog set,text1,%%b
  DIALOG SHOWmodal
wait event
goto @event()
 
  :Cancelbutton
  %%var = ""
  dialog select,0
exit
 
  :Combobutton1button
  %%var = @dlgtext(combo1)
  dialog select,0
  exit
 
 exit
 
 :askit
if @null(%%var)
%%send = no
else
%%send = yes
end
exit

:sendwithvar
dialog select,0
dialog disable,edit1
dialog enable,edit1
dialog focus,edit1

if @equal(%%b,info)
info %%c
exit
else
end

if @equal(%%b,Space)
window send,@win(~edit1),%%a" "%%var" "%%c@cr()
exit
else
end

if @equal(%%b,NoSpace)
window send,@win(~edit1),%%a""%%var""%%c@cr()
exit
else
end

if @equal(%%b,Quote)
window send,@win(~edit1),%%a""%%var@chr(34)""%%c@cr()
exit
else
end

if @equal(%%b,Backspace)
window send,@win(~edit1),@key(left)@key(del)@chr(32)%%a""%%var""%%c@cr()
exit
else
end

window send,@win(~edit1),%%a""%%var""%%c@cr()
exit




I think that we have to treat Large Fonts on a case to case bases if we are truly concerned about making our programs completely user friendly for this option scale,%%developerspixperin is not a very good catch all.

NodNarb


Last edited by cnodnarb on Sun Dec 22, 2002 9:49 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sun Dec 22, 2002 9:33 pm    Post subject: Reply with quote

OK OK, I submit, it is a pretty good catch all, but not perfect!! I looked through some previous post and found for them option scale,96 worked great...then I compared resize events.

I did my resize event in the above code a little odd, and that explains the scale issue with that utility...but my first one really does work better using option scale,97...and my opinion still stands...make sure what your using works.

NodNarb
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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