Drop Down Menu - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Drop Down Menu (/showthread.php?tid=992) |
Drop Down Menu - Dimster - 10-21-2022 Here is a bare bones of a drop down menu which I have been using. I have had to use a Slowing value to smooth out the speed at which the drop down occurs. I was wondering if there might be a better way to control the speed. Cls Screen _NewImage(1200, 900, 32) Dim Shared DarkGreen& Dim Shared Yellow& Dim Shared Pink& DarkGreen& = _RGB32(0, 129, 0) Yellow& = _RGB(255, 255, 0) Pink& = _RGB(216, 50, 166) 'Large background box Line (0, 0)-(1199, 50), Pink&, BF Sleep c1 = 7 r1 = 7 c2 = 126 r2 = 46 'The 5 smaller box Line (c1, r1)-(c2, r2), DarkGreen&, BF r1 = 51 r2 = 93 'The Drop Down For DDwn = 1 To 25 Color Yellow& _PrintString (12, 15), "Opening Info" Line (c1, r1)-(c2, r2), DarkGreen&, BF For slow = 1 To 10000000: Next r1 = r1 + DDwn r2 = r2 + DDwn Next Sleep RE: Drop Down Menu - SMcNeill - 10-21-2022 Instead of something like: For slow = 1 To 10000000: Next Use something which isn't going to depend upon the speed of the users PC to just add numbers in a loop. I'd suggest _LIMIT or _DELAY. RE: Drop Down Menu - Pete - 10-21-2022 Use _DELAY for these types of issues... Code: (Select All) CLS Pete RE: Drop Down Menu - Pete - 10-21-2022 Another fun one is TIMER. Code: (Select All) CLS RE: Drop Down Menu - Pete - 10-21-2022 Now let' take the last example and use it as a GOSUB... Code: (Select All) CLS Pete RE: Drop Down Menu - Dimster - 10-21-2022 Timer I have always used more for those routines where I need the min, hour, day, year type of stuff and can't recall the last time I use _Limit. It had never occurred to me to use either one of those to control the speed of the drop down. I do see where you are recommending _Delay as the best practice for this kind of speed control. It definitely works but when I ran it in that little snippet it seemed the graphic drop down box was picking up speed as it dropped. Optical illusion? Programming without glasses? It really isn't that big of deal. The _Delay is a much more elegant solution. Thanks Steve and Mr. Re-Gifted (loved that line in another thread Pete) RE: Drop Down Menu - Pete - 10-21-2022 (10-21-2022, 05:34 PM)Dimster Wrote: Timer I have always used more for those routines where I need the min, hour, day, year type of stuff and can't recall the last time I use _Limit. It had never occurred to me to use either one of those to control the speed of the drop down. That's because of 2 things. 1) Your first green block is so much thicker that it looks like it starts faster. 2) You are going back to a thin block but growing it by one with each next loop, so it looks like it is speeding up as it continues. Something like this may be more of what you are trying for... Code: (Select All) CLS Pete - The Re-Gifted Child. RE: Drop Down Menu - Dimster - 10-21-2022 That works great Pete, thanks |