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 


Request For Comment (RFC): VDS Built Custom Controls for VDS

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


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Apr 20, 2011 5:54 am    Post subject: Request For Comment (RFC): VDS Built Custom Controls for VDS Reply with quote

Request For Comment (RFC): VDS Built Custom Controls for VDS 4/19/2011

General purpose is to be stated in post one.

Discussion points in post two.

Code samples and code requirements in post three.

Comments in all following post. Comments will be integrated into initial post as is deemed meet and fit with notification from contribution initiator (cnodnarb).

<sorta legal stuff that probably has more holes than a rat infested pile of underwear, try to get the jist>
Should cnodnarb fail at task (fall inactive in project for an extended time), please begin a new topic copying the first three post after discussing and gaining three consents. cnodnarb permits you copyleft authority in these instances and the new initiator falls under this arbitration as well. Please notify cnodnarb at brandoncomputer@hotmail.com every single time this occurs to settle disputes in current initiator. Only ONE active version of this document should recieve continual updates at any given time. Copyleft authority is voided to your thread in the instance you choose not to accept the original initiators (cnodnarb's) settlement of such dispute. Such a dispute will usually be resolved by determining which potential new initiator gained three consents from other contributors. Branches MAY exists, but they do not fall under the restrictions of this copyleft clause, and those projects must only make public the current initiators code thread.
<end legal>

In basic, This RFC and code samples are copyleft, free to copy and modify as long as the base code of the current initiator remains public.

I hope the above legal clause is a bit more clear than mud. I'm open to a better way to say it, any suggestions?


The general purpose behind this project is to allow reusable custom controls to be built within VDS for other VDS programs. Created controls need not be ingenious in nature, only reusable and useful (the goal is to not recreate the wheel).

The goal is to abstract the control to the point of very simple ease of use within parent programs (at the cost of some additional coding to create the control initially).

The majority of DSU's have been console in nature, that is to say, do not return a visual dialog but a return variable or action. This RFC is intended specifically for commands and functions that will return a visual dialog or interact with a visual dialog that is not part of the main program.

Most of the discussions should revolve around the responsibilities of the parent window, the child window and shared responsibilities.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Apr 20, 2011 5:54 am    Post subject: Reply with quote

5/1/2011
Parent: Host window for the control.
Control: Notitle dialog within DSU to be parented.

1. Parenting the control to the parent is to be handled within the DSU file before the control is shown, controls can only be added after the parent window is shown.

2. Multiple controls may exists within one DSU.

3. The control must not be single instance. More than one control must be able to exists on a form just like dialog elements.

4. Implementation must allow for seperate forms to have the same control name in multiple form instances (MDI Style apps, not necessarily parented).

5. The parent is to have a class.

6. All dialog elements names within control are to be based on controlname.

7. Controls must be selected within the parent using dialog select before commands or function calls are made. This is far easier to specify than forcing the control developer to array controls. This is an OPINION. Please discuss if you'd like it changed. So rather than @controlsamplegetvalue(controlsample1) it is dialog select,1 @controlsamplegetvalue(). This may need to be up for discussion. If you choose to discuss this item a code solution or psuedocode or a clear concept of how to achieve should be included. My opinion stands thus far due to the functionality of @event(d), you gotta defeat that to change my mind.

8. All controls must contain an an update command. The update command handles resizing the control within the control code as well as any event that should occur on a timer or other event fire. This update command accepts the dialog number as a parameter ie "controlsample update,1"
[DELETED]All controls must contain a controlresize event to be called within the parents resize event. The controlresize event goes back to evloop upon completion.[/DELETED]
[delete] large portion of code displayed for about 2 hours, irrelevant due to new sendmessage findings.[/delete]

9. Only one command and one function per control. Dynamic parameter to be passed by %2 in the control calls. VDSDOM50.DSU fails grievously at this aspect, to where as the browser control succeeds (granted that's not a DSU, but same concept applies).

10. Controls are to be accessed by a developer defined control command. The syntax will be as follows:
<control> add,<controltype>,<controlname>,<#parent>,<top>,<left>,<width>,<height>,<custom>

[11 was misdefined/invalid, article items will not be renumbered when this occurs to maintain relevance/correlation of post]

12. The parent event loop label is to always be 'evloop' with certain standard lines for using controls within. Controls must not contain the labels evloop, resize, timer or close.

13. Unique dialog element and variable names must be used within the control.

14. Primary window focus or window activation occurs within the control update command called by the main program. This event also triggers all control updates such as resizing and calculations. Controls may not contain their own timer, the update command is usually called within the timer triggered by wait event,<time>.
[DELETED]Window activation in theory should be handled by the control, but this is tricky. Be aware when using controls it may be necessary to activate your main window within the main code. All attempts should be made to handle within the control.[/DELETED]

15. Parent window must be stored in unique variable for each control. Control developers may want to consider variants of this variable for each control to avoid referencing the wrong parent in the case of the control being on multiple parent forms. A good suggestion is to store in a hidden text dialog element.
[DELETED]Caller window variable to be stored in the control as variable %%mainwin.[/DELETED]

16. Multiple Window Interface Applications where the same form is instanced more than once (multiple parents) must use a counter for creating the main class of the parent to ensure that the parent/control relationship is correct. (,class parent%%count)

17. The control should (sometimes is OK not to for toolwindows, etc). be hosted on a notitle form so it is static/controlled by the user.

18. The control must either A: Have all created dialog element values abstracted to functions or B: Have all dialog elements clearly documented if the DSU is compiled.

19. The opposite of the original statement is true. Invisible style should not be used, and element containers are suggested. This is due to some fundamental changes that have been discovered since inception (failure to resize child pedestals upon control position change, the fact a click through is not needed now that dialog focus/window activate is not needed to keep the parent window title bar active, etc.)
[DELETED]The invisible style should be used for the main form of the control (in most cases). Groups, tabs and other element containers should be avoided.[/DELETED]

20. For open source controls, I suggest the developer distribute the ascii source file with the .ctl extension. Users can access this in code by:
Code:

#include control.ctl

Note that binary compiled controls must have the .dsu extension.

21. Dialog select,dialog select, dialog select, dialog select...
Dialog select rules. Use it. Previous comment invalid due to buggy behavior when using functions within command calls, so unless you enjoy abstracting functions to variables constantly...use dialog select.
[deleted]
To avoid constant use of dialog select all commands and functions are to have two optional final parameters as integer. These optional commands will perform dialog select,<i> at the beginning and end of the function.
NOTE: Lot's of errors with item 21 when using Dialog Set command. May still be necessary to use dialog select in scripts.[/deleted]

22. Problems with parent window losing focus resolved by first calling WS_CHILD prior to SetParent. Fixes a myriad of other troubles as well, the child actually completely glues to the parent, including tooltips etc.
Code:

LOADLIB user32.dll
 if @ok()
 %%k = @strdel(@winexists(@dlgtext()),1,1)
  %%knockout = @lib(user32,SetWindowLongA,INT:,%%k,-16,$40000000)
 %%controlsampledummy = @lib(user32.dll,SetParent,NIL,%%k,@strdel(@winexists(@dlgtext(browserparent)),1,1))
 end
 FREELIB user32.dll


Last edited by cnodnarb on Sun May 01, 2011 9:08 am; edited 22 times in total
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Apr 20, 2011 5:55 am    Post subject: Reply with quote

4/21/2011

evloop requirement
Code:

rem parent code.
:evloop
rem select dialog 1, update controlsample 1
controlsample update,1
rem select dialog 2, update controlsample 2
controlsample update,2
wait event
parse "%%event;%%dialog",@event(d)
dialog select,%%dialog
goto %%event


control add sample
Code:

rem parent code
rem PARENT control must be showing before adding control.
dialog show
controlsample add,controlsample,controlsample1,#parent,20,20,200,100


Code:

rem control code
:controlsample
if @equal(%1,add)
goto checkcontroladdtype
end

:checkcontroladdtype
if @equal(%2,controlsample)
goto controlsampleadd
end

:controlsampleadd
dialog create,%3,%5,%6,%7,%8,,notitle,class controlsample
dialog add,group,group1,0,0,150,80
dialog add,button,buttonGetDircontrolsample,20,20,100,20,Select Directory
dialog add,edit,editShowDircontrolsample,40,20,100,20
%%mainwin = %4
LOADLIB user32.dll
  if @ok()
  %%controlsampledummy%3 = @lib(user32.dll,SetParent,NIL,@strdel(@winexists(@dlgtext()),1,1),@strdel(@winexists(%%mainwin),1,1))
  end
  FREELIB user32.dll
    dialog show
   
    exit


spreadsheet.dsc, parent window.
Code:

rem info %1
gosub initialize

  external vdsbrw50.dll
#include browse.ctl
title Simple Spreadsheet
  DIALOG CREATE,Simple Spreadsheet,-1,0,800,600,RESIZABLE,savepos,class spxreadsheet
     dialog add,menu,&File,&New,&Open,&Save,&Save As,&Publish
     dialog add,status,status1
    DIALOG SHOW
REM *** Modified by Dialog Designer on 4/10/2011 - 22:48 ***
  browse add,browse,browser1,#spxreadsheet,0,0,@dlgpos(,w),@diff(@dlgpos(,h),20)
   %%browser = @browse(browser,1)
  dialog add,button,hidecaret,0,0,20,20," "

 rem dialog add,button,button1,0,0,100,200,test
 
 option errortrap,runas
registry write,root,.owx,,"Office.WebSpreadsheet"
registry write,root,Office.WebSpreadsheet\shell\Open\command,,@chr(34)%0@chr(34) @chr(34)@chr(37)1@chr(34)
    option errortrap,""
   
     if %1
  if @equal(%1,runasadmin)
   if %2
   dialog set,@browse(browser,1),%2
   else
   WAIT 0
   dialog set,@browse(browser,1),@path(%0)temp.html
   end
   
   else
  dialog set,@browse(browser,1),%1
  end
  else
   wait 0
   dialog set,@browse(browser,1),@path(%0)temp.html
  end
 
   repeat
   wait
   until @not(@browser(browser1,busy))

rem info @regread(root,.owx\shell\Open\command)
goto resize

 :timer
   browse update,1
 
   :evloop
  rem  %%t = @getdomreturn(@browse(browser),Book1_17125_Spreadsheet.ActiveCell.Value)
   dialog select,0
     if %%file
  dialog title,@name(%%file) - Simple Spreadsheet
   dialog set,status1,%%file
  else
  dialog title,Simple Spreadsheet
  end
    wait event,1
    parse "%%event;%%dialog",@event(d)
    dialog select,%%dialog
  goto %%event
 
  :hidecaretbutton
 dialog set,@browse(browser),javascript:alert(Book1_17125_Spreadsheet.ActiveCell.Formula);void(0);
  goto evloop
 
   :save asmenu
   dialog select,1
  dialog set,@browse(browser,1),@browse(getlargeattribute,tag,html,outerHTML,0,1)
  %%filedlg = @filedlg("HTML Spreadsheet (OWX)"|*.owx,Save "Spreadsheet",,save)
  if %%filedlg
  if @null(@ext(%%filedlg))
  %%filedlg = %%filedlg.owx
  end
  browser savefile,@browse(browser,1),%%filedlg
  %%file = %%filedlg
  else
rem  info Save aborted.
  end
  goto evloop
 
  :savemenu
  if %%file
  rem do nothing
  else
  goto save asmenu
  end
  dialog select,1
     dialog set,@browse(browser,1),@browse(getlargeattribute,tag,html,outerHTML,0)
         browser savefile,@browse(browser),%%file 
      goto evloop
     
  :openmenu
  %%file = @filedlg("HTML Spreadsheet (OWX)"|*.owx,"Open Spreadsheet")
  if %%file
  dialog select,1
  dialog set,@browse(browser,1,0),%%file
  rem setattribute browser1,tag,body,contentEditable,True,0
  end
  goto resize
 
  :newmenu
  %%ask = @ask(Save Spreadsheet?)
  if %%ask
  goto save asmenu
  end
  %%file = ""
  dialog select,1
  dialog set,@browse(browser,1),@path(%0)temp.html
    goto resize
 
  :close
  exit
 
  :resize
  %%browserwin = @browse(window,1,0)
  %%width = @dlgpos(,w)
  %%height = @diff(@dlgpos(,h),20)
  %%h = @diff(@dlgpos(,h),25)
  %%w = @diff(@dlgpos(,w),5)
  window position,%%browserwin,0,0,%%width,%%height
rem  window position,@window(@getbrowserid2(),CHILD),0,0,@dlgpos(,w),@diff(@dlgpos(,h),20)
browse update,1
dialog setpos,hidecaret,@diff(@dlgpos(,h),20),@diff(@dlgpos(,w),20),20,20
  browse setattribute,id,Book1_17125_Spreadsheet,height,%%h
  browse setattribute,id,Book1_17125_Spreadsheet,width,%%w
  goto evloop


     :runas
     if %1
     shell runas,@chr(34)%1@chr(34),runasadmin
     else
     shell runas,@chr(34)%0@chr(34),runasadmin,@chr(34)@Path(%0)@chr(34)
     end
     stop
     
     :publishmenu
    rem Content-Type: text/html
   rem Content-Transfer-Encoding: 8bit
 %%xl = @browse(getlargeattribute,tag,html,outerHTML,0,1)
 dialog set,@browse(browser),<!--@cr()Content-Type: text/html@cr()Content-Transfer-Encoding: 8bit@cr()@cr()%%xl
  %%filedlg = @filedlg("Web Archive (MHT)"|*.mht,Save "Spreadsheet",,save)
  if %%filedlg
  if @null(@ext(%%filedlg))
  %%filedlg = %%filedlg.mht
  end
  browser savefile,@browse(browser),%%filedlg
  %%file = %%filedlg
  else
rem  info Save aborted.
  end
  goto evloop

 
  :initialize
   list create,1
 list loadtext,1
"<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:x = "urn:schemas-microsoft-com:office:excel"><HEAD>
"<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
"<META name=ProgId content=FrontPage.Editor.Document>
"<META name=Generator content="Microsoft Excel 11"><LINK rel=File-List href="Book1_files/filelist.xml"></HEAD>
"<BODY style="overflow:'hidden'" contentEditable=false style="margin-top:0;margin-left:0;margin-bottom:0;margin-right:0">
"<DIV id=Book1_17125 align=center x:publishsource="Excel" height=100% width=100% style="margin-top:0;margin-left:0;margin-bottom:0;margin-right:0">
"<OBJECT style="margin-top:0;margin-left:0;margin-bottom:0;margin-right:0" id=Book1_17125_Spreadsheet classid=CLSID:0002E559-0000-0000-C000-000000000046 width=100% height=100%>
"<PARAM NAME="AllowPropertyToolbox" VALUE="1">
"<PARAM NAME="AutoFit" VALUE="0">
"<PARAM NAME="Calculation" VALUE="-4105">
"<PARAM NAME="Caption" VALUE="Freedom Spreadsheet">
"<PARAM NAME="DisplayColumnHeadings" VALUE="-1">
"<PARAM NAME="DisplayGridlines" VALUE="-1">
"<PARAM NAME="DisplayHorizontalScrollBar" VALUE="-1">
"<PARAM NAME="DisplayOfficeLogo" VALUE="0">
"<PARAM NAME="DisplayWorkbookTabs" VALUE="0">
"<PARAM NAME="DisplayPropertyToolbox" VALUE="-1">
"<PARAM NAME="DisplayRowHeadings" VALUE="-1">
"<PARAM NAME="DisplayTitleBar" VALUE="0">
"<PARAM NAME="DisplayToolbar" VALUE="0">
"<PARAM NAME="DisplayVerticalScrollBar" VALUE="-1">
"<PARAM NAME="MaxHeight" VALUE="100%">
"<PARAM NAME="MaxWidth" VALUE="100%">
"<PARAM NAME="DisplayWorkbookTabs" VALUE="-1">
"<PARAM NAME="EnableEvents" VALUE="-1">
"<PARAM NAME="MoveAfterReturn" VALUE="-1">
"<PARAM NAME="MoveAfterReturnDirection" VALUE="-4121">
"<PARAM NAME="RightToLeft" VALUE="0">
"<PARAM NAME="ScreenUpdating" VALUE="-1">
"<PARAM NAME="LockedDown" VALUE="0">
"<PARAM NAME="ConnectedToChart" VALUE="0">
"<PARAM NAME="DefaultQueryOnLoad" VALUE="-1">
"<PARAM NAME="EnableUndo" VALUE="-1">
"<PARAM NAME="DataType" VALUE="XMLDATA">
"<PARAM NAME="XMLData" VALUE='<?xml version="1.0"?> <ss:Workbook xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"> <x:ExcelWorkbook>  
"<x:ProtectStructure>False</x:ProtectStructure>   <x:ActiveSheet>0</x:ActiveSheet> </x:ExcelWorkbook>
"<ss:Styles>   <ss:Style ss:ID="Default">    <ss:Alignment ss:Horizontal="Automatic" ss:Rotate="0.0"
"ss:Vertical="Bottom"     ss:ReadingOrder="Context"/>    <ss:Borders>    </ss:Borders>    
"<ss:Font ss:FontName="Arial" ss:Size="10" ss:Color="Automatic" ss:Bold="0"     ss:Italic="0"
"ss:Underline="None"/>    <ss:Interior ss:Color="Automatic" ss:Pattern="None"/>    <ss:NumberFormat
"ss:Format="General"/>    <ss:Protection ss:Protected="1"/>   </ss:Style> </ss:Styles>
"<c:ComponentOptions>   <c:Label>    <c:Caption>Microsoft Office Spreadsheet</c:Caption>  
"</c:Label>   <c:SpreadsheetAutoFit/>   <c:MaxHeight>80%</c:MaxHeight>  
"<c:MaxWidth>80%</c:MaxWidth>   <c:NextSheetNumber>4</c:NextSheetNumber> </c:ComponentOptions>
"<x:WorkbookOptions>   <c:OWCVersion>11.0.0.5531         </c:OWCVersion> </x:WorkbookOptions>
"<ss:Worksheet ss:Name="Sheet1">   <x:WorksheetOptions>    <x:Selected/>    
"<x:ViewableRange>R1:R262144</x:ViewableRange>    <x:Selection>R1C1</x:Selection>    
"<x:TopRowVisible>0</x:TopRowVisible>    <x:LeftColumnVisible>0</x:LeftColumnVisible>    
"<x:ProtectContents>False</x:ProtectContents>   </x:WorksheetOptions>   <c:WorksheetOptions>  
"</c:WorksheetOptions> </ss:Worksheet> <ss:Worksheet ss:Name="Sheet2">  
"<x:WorksheetOptions>    <x:ViewableRange>R1:R262144</x:ViewableRange>    
"<x:Selection>R1C1</x:Selection>    <x:TopRowVisible>0</x:TopRowVisible>    
"<x:LeftColumnVisible>0</x:LeftColumnVisible>    <x:ProtectContents>False</x:ProtectContents>  
"</x:WorksheetOptions>   <c:WorksheetOptions>   </c:WorksheetOptions> </ss:Worksheet>
"<ss:Worksheet ss:Name="Sheet3">   <x:WorksheetOptions>    
"<x:ViewableRange>R1:R262144</x:ViewableRange>    <x:Selection>R1C1</x:Selection>    
"<x:TopRowVisible>0</x:TopRowVisible>    <x:LeftColumnVisible>0</x:LeftColumnVisible>    
"<x:ProtectContents>False</x:ProtectContents>   </x:WorksheetOptions>   <c:WorksheetOptions>  
"</c:WorksheetOptions> </ss:Worksheet> </ss:Workbook> '>
"   <p style='margin-top:100;font-family:Arial;font-size:8.0pt'>To use this Web
" page interactively, you must have Microsoft® Internet Explorer 5.01 Service
" Pack 2 (SP2) or later and the Microsoft Office 2003 Web Components.</p>
" <p style='margin-top:100;font-family:Arial;font-size:8.0pt'>See the <a
" href="http://r.office.microsoft.com/r/rlidmsowcpub?clid=1033&amp;p1=Excel">Microsoft
" Office Web site</a> for more information.</p></OBJECT></DIV></BODY></HTML>
   list savefile,1,@path(%0)temp.html
exit


browse.ctl
Code:

external vdsbrw50.dll
#define command,browser
#define function,browser
#define function,getdomreturn
#define command,setdom
#define command,browse
#define function,browse
#define function,domsearchloop

:browse
if @equal(%1,add)
goto addbrowse
end
if @equal(%1,update)
goto browseupdate
end
if @equal(%1,window)
goto browsewindow
end
if @equal(%1,browser)
goto browsebrowser
end
if @equal(%1,getdom)
goto getdomreturn
end
if @equal(%1,setdom)
goto setdom
end
if @equal(%1,selectAdd)
goto selectAddOption
end
if @equal(%1,selectRemove)
goto selectRemoveOption
end
if @equal(%1,noscroll)
goto browsernoscroll
end
if @equal(%1,norclick)
goto browsernorclick
end
if @equal(%1,zoom)
goto browserzoom
end
if @equal(%1,getattribute)
goto getattribute
end
if @equal(%1,setattribute)
goto setattribute
end
if @equal(%1,execcommand)
goto execcommand
end
if @equal(%1,getlargeattribute)
goto getlargeattribute
end
if @equal(%1,inserthtml)
goto inserthtml
end
if @equal(%1,getbrowserID)
goto getbrowserID
end

:addbrowse
%%browsecount = @succ(%%browsecount)
dialog create,%3,%5,%6,%7,%8,,notitle,class browsectl
dialog add,browser,browser%%browsecount,0,0,@dlgpos(,w),@dlgpos(,h),""
dialog add,text,browserctl,0,0,0,0,browser%%browsecount
dialog hide,browserctl
dialog add,text,browserparent,0,0,0,0,%4
dialog hide,browserparent
dialog add,text,browserchild,0,0,0,0,@winexists(#browsectl)
dialog hide,browserchild
LOADLIB user32.dll
 if @ok()
 %%controlsampledummy = @lib(user32.dll,SetParent,NIL,@strdel(@winexists(@dlgtext()),1,1),@strdel(@winexists(@dlgtext(browserparent)),1,1))
 end
 FREELIB user32.dll
    dialog show
    exit
   
:browseupdate
dialog select,%2
if @equal(@winactive(c),browsectl)
%P = @sendmsg(@winexists(@dlgtext(browserparent)),$0086,1,1)
end
dialog setpos,@dlgtext(browserctl),0,0,@dlgpos(,w),@dlgpos(,h)
if %3
dialog select,%3
end
exit

:browsewindow
if %2
dialog select,%2
end
%4 = @dlgtext(browserchild)
if %3
dialog select,%3
end
exit %4

:browsebrowser
if %2
dialog select,%2
end
%4 = @dlgtext(browserctl)
if %3
dialog select,%3
end
exit %4
   
      :getDOMreturn 
       option fieldsep,|
   %3 = @regread(curuser,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Cookies,0)
  list create,8
  list create,9
 %4 = @datetime()
dialog set,@dlgtext(browserctl),javascript:document.cookie = 'vdsdata=|%4|'+%2+'|;expires=Fri"," 26 Dec 2099 10:00:00 GMT';void(0);

list filelist,8,%3\*.*
:domsearchloop
%5 = @next(8)
if %5
list loadfile,9,%5
:domrecurse
%6 = @next(9)
if %6
parse ";%7;%8",%6
if @equal(%7,%4)
goto domendsearch
else
goto domrecurse
end
else
goto domsearchloop
end
else
%8 = ""
end
:domendsearch
list close,9
list close,8
exit %8

:browsernoscroll
if %2
dialog select,%2
end
dialog set,@dlgtext(browserctl),javascript:document.getElementsByTagName('body')[0].style.overflow = 'hidden';void(0);
if %3
dialog select,%3
end
exit

:browsernorclick
if %2
dialog select,%2
end
 dialog set,@dlgtext(browserctl),javascript:function clickIE4(){if (event.button==2){return false;}}function clickNS4(e){if (document.layers||document.getElementById&&!document.all){if (e.which==2||e.which==3){return false;}}}if (document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;}else if (document.all&&!document.getElementById){document.onmousedown=clickIE4;}document.oncontextmenu=new Function('return false');void(0);
if %3
dialog select,%3
end
  exit
 
:setdom
dialog set,@dlgtext(browserctl),javascript:%2='%3';void(0);
exit
   
:selectAddOption
if %6
dialog select,%6
end
if @equal(@lower(%2),id)
dialog set,@dlgtext(browserctl),javascript:var y = new Option('%4');document.getElementById('%3').add("y,"2);void(0);
end

if @equal(@lower(%2),tag)
dialog set,@dlgtext(browserctl),javascript:var y = new Option('%4');document.getElementsByTagName('%3').item(%5).add("y,"2);void(0);
end

if @equal(@lower(%2),name)
dialog set,@dlgtext(browserctl),javascript:var y = new Option('%4');document.getElementsByName('%3').item(%5).add("y,"2);void(0);
end
if %7
dialog select,%7
end
exit

:selectRemoveOption
if %6
dialog select,%6
end
if @equal(@lower(%2),id)
dialog set,@dlgtext(browserctl),javascript:document.getElementById('%3').remove(%4)
end

if @equal(@lower(%2),tag)
dialog set,@dlgtext(browserctl),javascript:document.getElementsByTagName('%3').items.(%5).remove(%4)
end

if @equal(@lower(%2),name)
dialog set,@dlgtext(browserctl),javascript:document.getElementsByName('%3').items.(%5).remove(%4)
end
if %7
dialog select,%7
end
exit

:browserzoom
if %3
dialog select,%3
end
 dialog set,@dlgtext(browserctl),javascript:document.body.style.zoom='%2"%"';void(0);
 if %4
dialog select,%4
end
 exit
 
 :getattribute
 if %6
dialog select,%6
end
if @equal(@lower(%2),id)
%8 = @getdomreturn(@dlgtext(browserctl),"document.getElementById('"%3"')."%4)
end

if @equal(@lower(%2),tag)
%8 = @getdomreturn(@dlgtext(browserctl),"document.getElementsByTagName('"%3"').item("%5")."%4)
end

if @equal(@lower(%2),name)
%8 = @getdomreturn(@dlgtext(browserctl),"document.getElementsByName('"%3"').item("%5")."%4)
end
if %7
dialog select,%7
end

exit %8

:setattribute
if %7
dialog select,%7
end
if @equal(@lower(%2),id)
setdom @dlgtext(browserctl),"document.getElementById('"%3"')."%4,%5
end

if @equal(@lower(%2),tag)
setdom @dlgtext(browserctl),"document.getElementsByTagName('"%3"').item("%6")."%4,%5
end

if @equal(@lower(%2),name)
setdom @dlgtext(browserctl),"document.getElementsByName('"%3"').item("%6")."%4,%5
if %8
dialog select,%8
end
end
 
exit

:execcommand
if %3
dialog select,%3
end
dialog set,@dlgtext(browserctl),javascript:document.execCommand(%2);void(0);
if %4
dialog select,%4
end
exit

:getlargeattribute
if %6
dialog select,%6
end
%8 = @clipbrd()
if @equal(@lower(%2),id)
dialog set,@dlgtext(browserctl),javascript:window.clipboardData.setData('Text'"," document.getElementById('%3').%4); void(0);
end

if @equal(@lower(%2),tag)
dialog set,@dlgtext(browserctl),javascript:window.clipboardData.setData('Text'", "document.getElementsByTagName('%3').item(%5).%4); void(0);
end

if @equal(@lower(%2),name)
dialog set,@dlgtext(browserctl),javascript:window.clipboardData.setData('Text'"," document.getElementsByName('%3').item(%5).%4); void(0);
end
%9 = @clipbrd()
clipboard set,%8
if %7
dialog select,%7
end
exit %9

:inserthtml
if %3
dialog select,%3
end
dialog set,@dlgtext(browserctl),javascript:document.selection.createRange().pasteHTML('%2');void(0);
if %4
dialog select,%4
end
exit

:getbrowserID
     if %2
dialog select,%2
end
     %1 = @window(@dlgtext(),child)
     repeat
     %1 = @window(%1,next)
     if @null(%1)
     %1 = @window(%2,child)
     end
     %2 = %1
     until @equal(@winclass(%1),Internet Explorer_Server)
          if %3
dialog select,%3
end
     exit %1
     
     :createfocused
     if %2
dialog select,%2
end
       dialog set,@dlgtext(browserctl),"javascript:var elements = document.getElementsByTagName('*'); var count = elements.length; for (i=0; i<count; i++) {    elem = document.getElementsByTagName('*').item(i);    elem.focused = false;    elem.hasFocus = function() {        return this.focused;    };    elem.onfocus=function() {        this.focused=true;    };    elem.onblur=function() {        this.focused=false;    };void(0);}"
 if %3
dialog select,%3
end
   exit
   
   :getelementcount
   if %4
   dialog select,%4
   end
   if %5
   %5 = %%exitdialog
   else
   %%exitdialog = ""
   end
   
   %9 = %2
         option fieldsep,|
  list create,8
  list create,9
 %4 = @datetime()
 if @equal(@lower(%9),tag)
  dialog set,@dlgtext(browserctl),javascript:var elements = document.getElementsByTagName('%3'); var count = elements.length;document.cookie = 'vdsdata=|%4|'+count+'|;expires=Fri"," 26 Dec 2099 10:00:00 GMT';void(0);
 end
 if @equal(@lower(%9),id)
 dialog set,@dlgtext(browserctl),javascript:var elements = document.getElementById('%3'); var count = elements.length;document.cookie = 'vdsdata=|%4|'+count+'|;expires=Fri"," 26 Dec 2099 10:00:00 GMT';void(0);
 end
  if @equal(@lower(%9),name)
 dialog set,@dlgtext(browserctl),javascript:var elements = document.getElementsByName('%3'); var count = elements.length;document.cookie = 'vdsdata=|%4|'+count+'|;expires=Fri"," 26 Dec 2099 10:00:00 GMT';void(0);
 end
 %3 = @regread(curuser,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Cookies,0)
  list filelist,8,%3\*.*
  %%dom = @domsearchloop()
  if %%exitdialog
  dialog select,%%exitdialog
  end
  exit %%dom
 
  :setfocus
  if %5
  dialog select,%5
  end
  if @equal(@lower(%2),id)
dialog set,@dlgtext(browserctl),javascript:document.getElementById('%3').focus(); void(0);
end

if @equal(@lower(%2),tag)
dialog set,@dlgtext(browserctl),javascript:document.getElementsByTagName('%3').item(%4).focus(); void(0);
end

if @equal(@lower(%2),name)
dialog set,@dlgtext(browserctl),javascript:document.getElementsByName('%3').item(%4).focus(); void(0);
end
if %6
dialog select,%6
end
exit


Last edited by cnodnarb on Sun May 22, 2011 5:35 am; edited 2 times in total
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun May 01, 2011 3:26 pm    Post subject: VDS Built Custom Controls for VDS - breakthrough Reply with quote

The code below glues notititle dialogs to parent forms, causing tootips etc. to function correctly and the parent window to keep focus.

Code:

LOADLIB user32.dll
 if @ok()
 %%k = @strdel(@winexists(@dlgtext()),1,1)
  %%knockout = @lib(user32,SetWindowLongA,INT:,%%k,-16,$40000000)
 %%controlsampledummy = @lib(user32.dll,SetParent,NIL,%%k,@strdel(@winexists(@dlgtext(browserparent)),1,1))
 end
 FREELIB user32.dll
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun May 22, 2011 3:58 am    Post subject: Reply with quote

Minor updates to spreadsheet.dsc

Please note the XML spreadsheet does NOT copy and paste well into the VDS IDE.

[edit]

Found the real reason for need for updates.

When using multiple dialog set,browser[] for navigation you MUST use a loop to wait until the browser is no longer busy.

Code:
   repeat
   wait
   until @not(@browser(browser1,busy))
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 Open Source Projects 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