View previous topic :: View next topic |
Author |
Message |
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Mon May 02, 2011 2:24 am Post subject: Negative Positioning |
|
|
Code: |
DIALOG CREATE,New Dialog,-1,0,800,480
REM *** Modified by Dialog Designer on 5/1/2011 - 20:04 ***
DIALOG ADD,BUTTON,BUTTON1,0,0,,,BUTTON1
DIALOG SHOW
wait 3
%%k = @strdel(@winexists(~button1),1,1)
info @winpos(@winexists(~button1),l) @winpos(@winexists(~button1),t)
LOADLIB user32.dll
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%k,0,-5,-5,70,75,$0040)
FREELIB user32.dll
wait event |
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Mon May 02, 2011 3:09 am Post subject: |
|
|
A little more advanced example.
Code: | DIALOG CREATE,New Dialog,-1,0,373,600
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,600
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,1200
dialog disable,BITBTN1
%%count = -1
repeat
%%count = @succ(%%count)
list add,list1,%%count
until @equal(%%count,108)
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),355,1200,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop |
The shown top at scroll bottom must equal (element size - form size)/10 = scroll goal
logic notes:
[
(element size - form size)/10 = scroll goal
element size/10 = first guess
list count = first guess
scroll to bottom. press button1 = result
result - scroll goal = subtract
list count = first guess - subtract
]
For actual implementation should probably use %0 + params to handle resize for smooth scrolling similar to DynPos.
Description: |
|
Download |
Filename: |
calc list fill.zip |
Filesize: |
4.4 KB |
Downloaded: |
1617 Time(s) |
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Mon May 02, 2011 5:39 am Post subject: |
|
|
EDIT minor corrections 5/2/2011
Code: |
DIALOG CREATE,New Dialog,-1,0,373,100
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,100
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,5000
dialog disable,BITBTN1
%%count = -1
%%listsize = @dlgpos(list1,h)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
:skipscroll
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),355,%%controlsize,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop
|
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Nov 06, 2012 7:32 pm Post subject: |
|
|
I really would like to use this, but how can I get it to work on a resizable window?
I have a dialog that has an edit box 24 from top and 2 left, I want to have a menu item that takes the text from that and then removes the edit box and replace it with a EXTTEXT control and allow some limited HTMLish support without using an external dll. Anyway, I need a way to be able to scroll the EXTTEXT element of the text runs off the dialog. Know what I mean? Hope I explained it well.
Thanks!
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Wed Nov 07, 2012 5:10 am Post subject: |
|
|
Yes!
It's been a while since I posted this. Let me play with it.
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Wed Nov 07, 2012 5:23 am Post subject: |
|
|
Replace the button1 control with the type of control you need, I want to see the finished product!! (Compiled or code, don't care).
Code: |
DIALOG CREATE,New Dialog,-1,0,373,100,resizable
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,100
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,5000
dialog disable,BITBTN1
%%count = -1
%%listsize = @dlgpos(list1,h)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
:skipscroll
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop
:resize
dialog setpos,list1,0,@diff(@dlgpos(,w),44),44,@dlgpos(,h)
rem MUST HIDE LIST!!
dialog setpos,bitbtn1,0,@diff(@dlgpos(,w),44),25,@dlgpos(,h)
goto evloop
|
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Wed Nov 07, 2012 5:48 am Post subject: |
|
|
Improved.
Known issues:
Element scrolls back to top after resize. Should be able to fix by grabbing scrollbar position before resize, then setter the position after resize. Rusty on how to do so. If looks buggy, lock the screen for refresh then unlock at end of resize. Once again, forgot how, but should be easy to look up.
Code: |
DIALOG CREATE,New Dialog,-1,0,373,100,resizable
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,100
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,5000
dialog disable,BITBTN1
%%count = -1
%%listsize = @dlgpos(list1,h)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
:skipscroll
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop
:resize
dialog setpos,list1,0,@diff(@dlgpos(,w),44),44,@dlgpos(,h)
rem MUST HIDE LIST!!
dialog setpos,bitbtn1,0,@diff(@dlgpos(,w),44),25,@dlgpos(,h)
rem Adjustable? Not sure about the precision math, adjusted by 30 so whole element scrolls into view: on my machine.
%%listsize = @diff(@dlgpos(list1,h),30)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
%%count = 0
list clear,list1
rem list clear,button1
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto evloop
|
|
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Wed Nov 07, 2012 2:35 pm Post subject: |
|
|
Fixed bug, didn't freeze for refresh (Not needed on this example)
Code: |
DIALOG CREATE,New Dialog,-1,0,373,100,resizable
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,100
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,5000
dialog disable,BITBTN1
%%count = -1
%%listsize = @dlgpos(list1,h)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
:skipscroll
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop
:resize
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
dialog setpos,list1,0,@diff(@dlgpos(,w),44),44,@dlgpos(,h)
rem MUST HIDE LIST!!
dialog setpos,bitbtn1,0,@diff(@dlgpos(,w),44),25,@dlgpos(,h)
rem Adjustable? Not sure about the precision math, adjusted by 30 so whole element scrolls into view: on my machine.
%%listsize = @diff(@dlgpos(list1,h),30)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
%%count = 0
list clear,list1
rem list clear,button1
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
LOADLIB user32.dll
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
%%knockout = @lib(user32,SetScrollPos,INT:,%%k,1,%%knockout,1)
FREELIB user32.dll
goto evloop
|
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Wed Nov 07, 2012 2:59 pm Post subject: |
|
|
Great! Thanks. I'm going to give this a go!
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Thu Nov 08, 2012 5:28 am Post subject: |
|
|
Mitigate small scroll tick bug.
Code: |
DIALOG CREATE,New Dialog,-1,0,373,100,resizable
REM *** Modified by Dialog Designer on 5/1/2011 - 21:04 ***
DIALOG ADD,LIST,LIST1,0,333,40,100
DIALOG ADD,BITBTN,BITBTN1,0,322,32,600
DIALOG SHOW
dialog add,button,button1,0,0,355,5000
dialog disable,BITBTN1
%%count = -1
%%listsize = @dlgpos(list1,h)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
:skipscroll
:timer
%%k = @strdel(@winexists(~list1),1,1)
%%b = @strdel(@winexists(~button1),1,1)
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
FREELIB user32.dll
:evloop
wait event,.1
goto @event()
:close
exit
:button1button
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
info %%knockout
goto evloop
:resize
LOADLIB user32.dll
%%knockout = @lib(user32,GetScrollPos,INT:,%%k,1)
FREELIB user32.dll
dialog setpos,list1,0,@diff(@dlgpos(,w),44),44,@dlgpos(,h)
rem MUST HIDE LIST!!
dialog setpos,bitbtn1,0,@diff(@dlgpos(,w),44),25,@dlgpos(,h)
rem Adjustable? Not sure about the precision math, adjusted by 30 so whole element scrolls into view: on my machine.
%%listsize = @diff(@dlgpos(list1,h),30)
%%controlsize = @dlgpos(button1,h)
if @greater(0,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
goto skipscroll
end
%%count = 0
list clear,list1
rem list clear,button1
repeat
%%count = @succ(%%count)
list add,list1,%%count
rem list add,button1,%%count
rem don't ask.
until @equal(%%count,@sum(@name(@fdiv(@diff(%%controlsize,%%listsize),10)),@diff(@name(@fdiv(%%listsize,@sendmsg(@winexists(~list1),$1A1))),1)))
rem mitigate small scroll tick issue
list seek,list1,%%knockout
rem mitigate small scroll tick issue
LOADLIB user32.dll
%%SetWindowPos = @lib(user32.dll,SetWindowPos,INT:,%%b,0,0,@fmul(%%knockout,-10),@diff(@dlgpos(,w),18),%%controlsize,$0040)
%%knockin = @lib(user32,SetScrollPos,INT:,%%k,1,%%knockout,1)
FREELIB user32.dll
goto evloop
|
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Thu Nov 08, 2012 3:29 pm Post subject: |
|
|
Well, this code is not going to work for what I need. The EXTTEXT element does not have an ID. I cannot use @winexists() to be able to do it and I don't what to have to add extra element to get the size and such to try and make it work.
So, my work around it creating a second dialog and using the scrollbars parameter for the dialog, then using SetParent to attach it to the main dialog. So far that seems to be working well.
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Fri Nov 09, 2012 3:33 am Post subject: |
|
|
Nice plan!
Exttext inside of a group element might have worked
Cheers!
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Fri Nov 09, 2012 6:03 am Post subject: |
|
|
Ha, yes might have. Didn't think of that!
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Fri Nov 09, 2012 6:46 pm Post subject: |
|
|
I have my app ready for you to take a look at. Please let me know if it works ok for you. It is my Self Note app. You can download it here -> OOPS FOUND SOME BUGS
I don't have the readme.txt done yet so it is not included, but it shouldn't be hard to figure out.
The formatting items are under Read-Only Formatting and only show when the note is in READ-ONLY mode. Enter some text and formatting then set it to read-only. To do that, go under file and choose Make Read-Only. You should see the formatted text and be able to scroll if text is off the page along with resizing.
Let me know! Hope it works and you like it. I plan on releasing it when I am done the readme.txt file.
_________________ Chris
Http://theblindhouse.com
Last edited by LiquidCode on Fri Nov 09, 2012 7:59 pm; edited 1 time in total |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Fri Nov 09, 2012 6:52 pm Post subject: |
|
|
Since there is that problem with = signs in EXTTEXT, I am going to try to come up with a solution using a type of BB code so I can direct the links to the correct place.
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
|
|
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
|
|