Easy Dim

jegadk

Member
Licensed User
Longtime User
Hi.

Have looked around here without finding an answer.

When i code in a large project, and want a Dim in the globals, and i'm at any place in the code, it's irritating me to scroll to the top, and back again.

Would be nice if i could write "Dim test As String" at any place, mark the text, rightclick, and have two options (Sub Globals or Sub Process Globals) where i want the Dim to be placed. Then it automatically moves it to that sub.

Jesper
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
It would be even nicer to just be able to specify it like the Private/Public Keywords.

Private i as Int ' Process Global
Public i as Int ' Global (This is really what the current Globals are since you have to prefix with Activity Name)
Global i as Int ' True Global Accessed from Anywhere without Prefix

Dim i as Int
or
Local i as Int ' Local variable within a function

I had suggested in another request we also need true scope down to the location Dimmed. Like if you Dim a variable within an IF Block. Currently B4A always Dims at the top of the Function and putting a Dim within an If just puts a line in the If setting what you Dim to 0 or "".
 
Top