Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Mouse Wheel Scolling
#6
(11-12-2022, 04:38 AM)james2464 Wrote: I haven't used STATIC yet.   I don't think my programming is very sophisticated, so I usually just DIM SHARED most of the time.   I found that to be much easier than passing variables to sub programs and keeping track of that.   I assume that STATIC would be similar to CONST?  I checked the wiki and it says it's for retaining values, but I don't know what the difference would be (STATIC vs CONST)

I'm comfortable using SUB / END SUB for sure, just wondered if GOSUB might be an advantage sometimes, as it seems that was the case in this example.

STATIC is a bit like a local CONSTANT. That means it remains in the SUB. Let's say you are counting something with the variable cnt, but it isn't shared or passed. by declaring it as a STATIC variable, you can come back to the counting SUB and pick right up where you left off. If you didn't either pass the cnt variable, or declare it as SHARED or STATIC, cnt would be zeroed the next time the counting SUB call was made.

Code: (Select All)
SUB mySUB
STATIC cnt

Pete
Reply


Messages In This Thread
Simple Mouse Wheel Scolling - by Pete - 11-12-2022, 03:52 AM
RE: Simple Mouse Wheel Scolling - by james2464 - 11-12-2022, 04:16 AM
RE: Simple Mouse Wheel Scolling - by mnrvovrfc - 11-12-2022, 04:24 AM
RE: Simple Mouse Wheel Scolling - by james2464 - 11-12-2022, 04:38 AM
RE: Simple Mouse Wheel Scolling - by Pete - 11-12-2022, 04:56 AM
RE: Simple Mouse Wheel Scolling - by Pete - 11-12-2022, 04:52 AM
RE: Simple Mouse Wheel Scolling - by mnrvovrfc - 11-12-2022, 05:17 AM
RE: Simple Mouse Wheel Scolling - by james2464 - 11-12-2022, 05:30 AM
RE: Simple Mouse Wheel Scolling - by mnrvovrfc - 11-17-2022, 10:22 AM
RE: Simple Mouse Wheel Scolling - by grymmjack - 12-27-2022, 11:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Finances Utility ASCIIhole 6 440 02-02-2026, 06:21 PM
Last Post: ASCIIhole
  Simple Zeller's congruence to get day of week TDarcos 12 5,610 09-17-2024, 07:24 AM
Last Post: TDarcos
  Mouse Routine Pete 8 1,844 05-13-2024, 04:48 AM
Last Post: eoredson
  Archive-dot-org simple helper mnrvovrfc 11 2,620 07-14-2023, 12:43 AM
Last Post: grymmjack
  Simple directory display eoredson 0 529 03-29-2023, 03:01 AM
Last Post: eoredson

Forum Jump:


Users browsing this thread: 1 Guest(s)