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 


Scrollpanel Unit Control

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


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

PostPosted: Tue May 03, 2011 4:08 pm    Post subject: Scrollpanel Unit Control Reply with quote

Compliant with
Request For Comment (RFC): VDS Built Custom Controls for VDS
http://www.vdsworld.com/forum/viewtopic.php?t=5154

scrollpanel.dsu

Code:
:scrollpanel
 if @equal(%1,add)
 goto scrollpaneladd
 end
 if @equal(%1,update)
 goto scrollpanelupdate
 end
  if @equal(%1,size)
 goto scrollpanelsize
 end
 if @equal(%1,resize)
 goto scrollpanelresize
 end
  if @equal(%1,window)
 goto scrollpanelwindow
 end
 exit error
 :scrollpaneladd
  DIALOG CREATE,scrollpanel%2,%4,%5,%6,%7,,class scrollpanel,notitle
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
dialog add,edit,scrollwindow,0,0,0,0,@winexists(@dlgtext())
  DIALOG ADD,LIST,scrollpanellist1,0,@diff(@dlgpos(,w),40),40,@diff(@dlgpos(,h),20)
   dialog add,list,scrollpanellist2,@diff(@dlgpos(,h),40),-1,@diff(@dlgpos(,w),20),40
   dialog add,group,scrollpanelgroup2,0,0,@diff(@dlgpos(,w),19),@diff(@dlgpos(,h),19)
   dialog add,group,scrollpanelgroup1,0,0,%8,%9
   dialog disable,scrollwindow
      LOADLIB user32.dll
 if @ok()
 %%controlwindow = @strdel(@winexists(@dlgtext()),1,1)
  %%setwindowlonga = @lib(user32,SetWindowLongA,INT:,%%controlwindow,-16,$40000000)
 %%setparent = @lib(user32.dll,SetParent,NIL,%%controlwindow,@strdel(@winexists(%3),1,1))
 end
 FREELIB user32.dll
    dialog show
   
%%countscrollpanel = -1
 
rem repeat

list add,scrollpanellist2,a
 
%%LB_SETITEMHEIGHT = @sendmsg(@winexists(~scrollpanellist1),$1A0,0,15)
   
    %%scrollpanellistsize = @dlgpos(scrollpanelgroup2,h)
  %%controlsizescrollpanel = @dlgpos(scrollpanelgroup1,h)
  %%scrollpanellistwsize = @dlgpos(scrollpanelgroup2,w)
  %%controlwsizescrollpanel = @dlgpos(scrollpanelgroup1,w)
 
  if @greater(@dlgpos(scrollpanelgroup2,h),@dlgpos(scrollpanelgroup1,h))
dialog hide,scrollpanellist1
dialog setpos,scrollpanellist2,,,@dlgpos(,w)
dialog setpos,scrollpanelgroup2,0,0,@dlgpos(,w)
else
if @equal(@dlgpos(scrollpanelgroup2,h),@dlgpos(scrollpanelgroup1,h))
dialog setpos,scrollpanelgroup2,0,0,@dlgpos(,w)
dialog hide,scrollpanellist1
dialog setpos,scrollpanellist2,,,@dlgpos(,w)
else
  dialog show,scrollpanellist1
repeat
%%countscrollpanel = @succ(%%countscrollpanel)
list add,scrollpanellist1,%%countscrollpanel
rem don't ask.
until @equal(%%countscrollpanel,@sum(@name(@fdiv(@diff(%%controlsizescrollpanel,%%scrollpanellistsize),10)),@diff(@name(@fdiv(%%scrollpanellistsize,@sendmsg(@winexists(~scrollpanellist1),$1A1))),0)))

end
end

if @greater(@dlgpos(scrollpanelgroup2,w),@dlgpos(scrollpanelgroup1,w))
dialog hide,scrollpanellist2
dialog setpos,scrollpanelgroup2,,,,@dlgpos(,h)
dialog setpos,scrollpanellist1,,,,@dlgpos(,h)
else
if @equal(@dlgpos(scrollpanelgroup2,w),@dlgpos(scrollpanelgroup1,w))
dialog setpos,scrollpanelgroup2,,,,@dlgpos(,h)
dialog hide,scrollpanellist2
dialog setpos,scrollpanellist1,,,,@dlgpos(,h)
else
dialog show,scrollpanellist2
 %A = @sendmsg(@winexists(~scrollpanellist2),$0194,@diff(%%controlwsizescrollpanel,5),0) 
 end
 end
   
exit
   
   :scrollpanelsize
   dialog setpos,scrollpanelgroup1,0,0,%2,%3
   goto scrollpanelresize
   
   :scrollpanelupdate
   dialog select,%2
   %%scrollpanellist1 = @strdel(@winexists(~scrollpanellist1),1,1)
%%scrollpanelgroup1 = @strdel(@winexists(~scrollpanelgroup1),1,1)
%%scrollpanellist2 = @strdel(@winexists(~scrollpanellist2),1,1)
LOADLIB user32.dll
%%GetScrollPosV = @lib(user32,GetScrollPos,INT:,%%scrollpanellist1,1)
  %%GetScrollPosW = @lib(user32,GetScrollPos,INT:,%%scrollpanellist2,0)
  %%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%scrollpanelgroup1,0,@fmul(%%GetScrollPosW,-1),@fmul(%%GetScrollPosV,-10),@winpos(@winexists(~scrollpanelgroup1),w),@dlgpos(scrollpanelgroup1,h),$0040)
FREELIB user32.dll
exit
   
   :scrollpanelwindow
   exit @dlgtext(scrollwindow)
   
   :scrollpanelresize
DIALOG setpos,scrollpanellist1,0,@diff(@dlgpos(,w),40),40,@diff(@dlgpos(,h),20)
  dialog setpos,scrollpanellist2,@diff(@dlgpos(,h),40),-1,@diff(@dlgpos(,w),20),40
  dialog setpos,scrollpanelgroup2,0,0,@diff(@dlgpos(,w),19),@diff(@dlgpos(,h),19)
  %%countscrollpanel = -1
  list clear,scrollpanellist1
    %%scrollpanellistsize = @dlgpos(scrollpanelgroup2,h)
  %%controlsizescrollpanel = @dlgpos(scrollpanelgroup1,h)
  %%scrollpanellistwsize = @dlgpos(scrollpanelgroup2,w)
  %%controlwsizescrollpanel = @dlgpos(scrollpanelgroup1,w)
 
  if @greater(@dlgpos(scrollpanelgroup2,h),@dlgpos(scrollpanelgroup1,h))
dialog hide,scrollpanellist1
dialog setpos,scrollpanellist2,,,@dlgpos(,w)
dialog setpos,scrollpanelgroup2,0,0,@dlgpos(,w)
else
if @equal(@dlgpos(scrollpanelgroup2,h),@dlgpos(scrollpanelgroup1,h))
dialog setpos,scrollpanelgroup2,0,0,@dlgpos(,w)
dialog hide,scrollpanellist1
dialog setpos,scrollpanellist2,,,@dlgpos(,w)

else
  dialog show,scrollpanellist1
repeat
%%countscrollpanel = @succ(%%countscrollpanel)
list add,scrollpanellist1,%%countscrollpanel
rem don't ask.
until @equal(%%countscrollpanel,@sum(@name(@fdiv(@diff(%%controlsizescrollpanel,%%scrollpanellistsize),10)),@diff(@name(@fdiv(%%scrollpanellistsize,@sendmsg(@winexists(~scrollpanellist1),$1A1))),0)))

end
end

if @greater(@dlgpos(scrollpanelgroup2,w),@dlgpos(scrollpanelgroup1,w))
dialog hide,scrollpanellist2
dialog setpos,scrollpanelgroup2,,,,@dlgpos(,h)
dialog setpos,scrollpanellist1,,,,@dlgpos(,h)
else
if @equal(@dlgpos(scrollpanelgroup2,w),@dlgpos(scrollpanelgroup1,w))
dialog setpos,scrollpanelgroup2,,,,@dlgpos(,h)
dialog hide,scrollpanellist2
dialog setpos,scrollpanellist1,,,,@dlgpos(,h)
else
 dialog show,scrollpanellist2
 %A = @sendmsg(@winexists(~scrollpanellist2),$0194,@diff(%%controlwsizescrollpanel,5),0) 
 end
 end
exit


scrollpanel example.dsc
Code:
#include scrollpanel.dsc
#define command,scrollpanel
#define function,scrollpanel

DIALOG CREATE,New Dialog,-1,0,240,160,,,class parent
REM *** Modified by Dialog Designer on 5/3/2011 - 08:04 ***
  DIALOG SHOW

  rem We want the internal pane 700x700 so we can catch 14 buttons at 50x50
 
  scrollpanel add,scrollpanel1,#parent,0,0,240,160,700,700

  rem Gratuitous call, what if we didn't set the internal pane to being with?
 
  scrollpanel size,700,700
 
  rem The scrollpanel itself has to be big enough to catch all the button creations.
  rem This is a gratuitous call, the scrollpanel should have been first created at 700x700
  window position,@scrollpanel(window),0,0,700,700
  scrollpanel resize
 
%%count = 1
  repeat
  dialog add,button,button%%count,@fmul(@pred(%%count),50),@fmul(@pred(%%count),50),50,50
  %%count = @succ(%%count)
  until @equal(%%count,15)
 
  rem OK, let's fit the scrollpanel to the window.
  window position,@scrollpanel(window),0,0,240,160
  scrollpanel resize
 
  :timer
  rem this call handles the scrolling events.
  scrollpanel update,1
:evloop
wait event,.1
parse "%%event;%%dialog",@event(d)
if @equal(@substr(%%event,1,6),button)
info %%event
else
dialog select,%%dialog
goto %%event
end
goto evloop

:close
exit
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 5 Units 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