A few minor IDE "gotcha's"

Widget

Well-Known Member
Licensed User
Longtime User
These aren't major problems, just annoying "features" of the B4a Editor.

1) I have a dual screen monitor and the B4A IDE is full screen on the right monitor. When I compile the app and get an error, the Compile & Debug dialog comes up and it is positioned with 1/4 of it over the left monitor. I have to keep moving the dialog to the right so I can read the complete message. It would be nice if the Compile & Debug dialog could be centered over the monitor that has the B4A IDE.

2) If I have the Find/Replace dialog open from a previous search and I press Ctrl-F when I am in the Editor, focus still stays in the editor. Focus should go to the Find/Replace dialog. Many times I am typing in the search string only to discover I am still typing in the editor.

3) When in the Editor, F3 should search again for the current string. You have it opening the Find/Replace editor. Shift-F3 should search backwards.

4) The Find dialog doesn't save the previous search strings in a dropdown box (spinner) so I have to retype it all the time. It improves my typing, but slows me down. :)

5) I don't find bookmarks in the editor to be that useful, at least not as useful as in other editors like Delphi. I am used to being able to set a bookmark using Shift-Ctrl-1 and then when I want to go back to that bookmark I press Ctrl-1. That way I can set up my primary bookmarks with low numbers (code locations I use a lot) and higher numbers like 7,8,9 to temporary bookmarks. I can immediately jump to any bookmark I like. But with B4A I have to move through each bookmark looking for the one I want. This is a bit tedious.

Well, that's my 2 cents for today.

Widget
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I have the same problem with multiple monitors.
Erel - Here is some code I use in VB6, for whatever that's worth.
Or see MFC Example Multiple monitor support with GetSystemMetrics EnumDisplayMonitors and GetMonitorInfo
(I'm not assuming that you don't already have all this info, but just in case...)

B4X:
Public Const SM_XVIRTUALSCREEN = 76    'virtual desktop left
Public Const SM_YVIRTUALSCREEN = 77    'virtual top
Public Const SM_CXVIRTUALSCREEN = 78   'virtual width
Public Const SM_CYVIRTUALSCREEN = 79   'virtual height
Public Const SM_CMONITORS = 80         'number of monitors
Public Const SM_SAMEDISPLAYFORMAT = 81
Public Const MONITOR_DEFAULTTONULL As Long = &H0    'If the monitor is not found, return 0
Public Const MONITOR_DEFAULTTOPRIMARY As Long = &H1 'If the monitor is not found, return the primary monitor
Public Const MONITOR_DEFAULTTONEAREST As Long = &H2 'If the monitor is not found, return the nearest monitor
Global hMonitor!, hMonitor2!
Global NumMonitors
Global VirtualScrLeft!, VirtualScrTop!
Global VirtualScrHeight!, VirtualScrWidth!
Global Screen1Left!, Screen1Top!, Screen1Height!, Screen1Width!
Global Screen2Left!, Screen2Top!, Screen2Height!, Screen2Width!
Public Declare Function MonitorFromWindow Lib "user32" _
  (ByVal hwnd As Long, ByVal dwFlags As Long) As Long
Public Type RECT
   Left    As Long
   Top     As Long
   Right   As Long
   Bottom  As Long
End Type
Public Declare Sub CopyMemory Lib "kernel32" _
   Alias "RtlMoveMemory" _
  (Destination As Any, _
   source As Any, _
   ByVal Length As Long)
Public Declare Function EnumDisplayMonitors Lib "user32" _
  (ByVal hdc As Long, _
   ByVal lprcClip As Long, _
   ByVal lpfnEnum As Long, _
   dwData As Any) As Long
Public Declare Function GetSystemMetrics Lib "user32" _
   (ByVal nIndex As Long) As Long
'Menu Colors:
''''''''''''
Public Const MIM_BACKGROUND As Long = &H2
Public Const MIM_APPLYTOSUBMENUS As Long = &H80000000
Type MENUINFO
   cbSize As Long
   fMask As Long
   dwStyle As Long
   cyMax As Long
   hbrBack As Long
   dwContextHelpID As Long
   dwMenuData As Long
End Type
Declare Function DrawMenuBar Lib "user32" _
            (ByVal hwnd As Long) _
        As Long
Declare Function GetMenu Lib "user32" _
            (ByVal hwnd As Long) _
        As Long
Declare Function GetSystemMenu Lib "user32" _
            (ByVal hwnd As Long, _
             ByVal bRevert As Long) _
        As Long
Declare Function GetSubMenu Lib "user32.dll" _
            (ByVal hMenu As Long, _
             ByVal nPos As Long) _
        As Long
Declare Function SetMenuInfo Lib "user32" _
            (ByVal hMenu As Long, _
             mi As MENUINFO) _
        As Long
Declare Function CreateSolidBrush Lib "gdi32" _
            (ByVal crColor As Long) _
        As Long
Declare Function OleTranslateColor Lib "olepro32.dll" _
            (ByVal OLE_COLOR As Long, _
             ByVal HPALETTE As Long, _
             pccolorref As Long) _
        As Long
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function GetDesktopMaximumHeight() As Long
  'Return the maximum height of all monitors on the desktop.
  'If only one monitor, return screen height.
   If IsMultiMonitorSystem() Then
      GetDesktopMaximumHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN)
   Else
      GetDesktopMaximumHeight = Screen.Height \ Screen.TwipsPerPixelY
   End If
End Function
Private Function IsMultiMonitorSystem() As Boolean
  'Returns True if a multi-monitor system
   IsMultiMonitorSystem = GetSystemMetrics(SM_CMONITORS) > 1
End Function
Public Function MonitorEnumProc(ByVal hMonitor As Long, _
                                ByVal hdcMonitor As Long, _
                                ByVal rcMonitor As Long, _
                                ByVal dwData As Long) As Long
  Dim rc As RECT
  'copy the rectangle data from
  'rcMonitor into a RECT type
  CopyMemory rc, ByVal rcMonitor, Len(rc)
  If Screen1Width! = 0 Then
    Screen1Left! = BBEditor.ScaleX(rc.Left, vbPixels, vbTwips)
    Screen1Top! = BBEditor.ScaleX(rc.Top, vbPixels, vbTwips)
    Screen1Width! = BBEditor.ScaleX(rc.Right, vbPixels, vbTwips) - Screen1Left!
    Screen1Height! = BBEditor.ScaleX(rc.Bottom, vbPixels, vbTwips) - Screen1Top!
  ElseIf Screen2Width! < 1 And ((hMonitor = hMonitor2! And hMonitor2! < 9999999) Or (Abs(hMonitor - hMonitor2!) < 100 And hMonitor2! >= 9999999)) Then
    Screen2Left! = BBEditor.ScaleX(rc.Left, vbPixels, vbTwips)
    Screen2Top! = BBEditor.ScaleX(rc.Top, vbPixels, vbTwips)
    Screen2Width! = BBEditor.ScaleX(rc.Right, vbPixels, vbTwips) - Screen2Left!
    Screen2Height! = BBEditor.ScaleX(rc.Bottom, vbPixels, vbTwips) - Screen2Top!
  End If
  'return 1 to continue processing
  'monitor information, or return
  '0 to stop. Returning 1 obtains
  'info for all physical and invisible
  'pseudo-monitors associated with
  'mirroring drivers
   MonitorEnumProc = 1
End Function
Public Function GetMonitorByWindow(ByVal hwnd As Long) As Long
  'Returns a handle to the display monitor
  'that has the largest area of intersection
  'with the bounding rectangle of a specified
  'window.
  '
  'If the window specified by hwnd intersects
  'one or more display monitor rectangles,
  'the return value is an HMONITOR handle
  'to the display monitor that has the
  'largest area of intersection with the
  'window.
  '
  'If the window is currently minimized,
  'the window occupied before minimization
  'is returned.
  '
  'If the window does not intersect a display
  'monitor, the return value depends on the
  'value of dwFlags. Available values are:
  'MONITOR_DEFAULTTONEAREST: Returns a handle to the
  '                          display monitor that is
  '                          nearest to the window.
  'MONITOR_DEFAULTTONULL:    Returns NULL
  'MONITOR_DEFAULTTOPRIMARY: Returns a handle to the
  '                          primary display monitor.
   GetMonitorByWindow = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)
End Function
 
Public Sub SetupMultipleMonitors()
  NumMonitors = GetSystemMetrics(SM_CMONITORS)
  VirtualScrLeft! = BBEditor.ScaleX(GetSystemMetrics(SM_XVIRTUALSCREEN), vbPixels, vbTwips)
  VirtualScrTop! = BBEditor.ScaleX(GetSystemMetrics(SM_YVIRTUALSCREEN), vbPixels, vbTwips)
  VirtualScrHeight! = BBEditor.ScaleX(GetSystemMetrics(SM_CYVIRTUALSCREEN), vbPixels, vbTwips)
  VirtualScrWidth! = BBEditor.ScaleX(GetSystemMetrics(SM_CXVIRTUALSCREEN), vbPixels, vbTwips)
End Sub
 

nacnud

Member
Licensed User
Longtime User
A good option for searching, as I've just found out ( read elsewhere here ), is ctrl-i . Type that, then just start typing your search item. Then just press ctrl-i again to go to the next one...
 

Widget

Well-Known Member
Licensed User
Longtime User
A good option for searching, as I've just found out ( read elsewhere here ), is ctrl-i . Type that, then just start typing your search item. Then just press ctrl-i again to go to the next one...

That's clever. And if you want to search backwards, use Shift-Ctrl-I.
(The Ctrl-F still needs a combo box for previous searches though)

Widget
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
If we click the Play button, and the app is already running
Could it press the stop button and close the previous compiler window?

Add a button to compile silently, or let us set that as our default

Let us copy (and paste?) values from the variable monitor.
 

aalekizoglou

Member
Licensed User
Longtime User
These aren't major problems, just annoying "features" of the B4a Editor.

1) I have a dual screen monitor and the B4A IDE is full screen on the right monitor. When I compile the app and get an error, the Compile & Debug dialog comes up and it is positioned with 1/4 of it over the left monitor. I have to keep moving the dialog to the right so I can read the complete message. It would be nice if the Compile & Debug dialog could be centered over the monitor that has the B4A IDE.

2) If I have the Find/Replace dialog open from a previous search and I press Ctrl-F when I am in the Editor, focus still stays in the editor. Focus should go to the Find/Replace dialog. Many times I am typing in the search string only to discover I am still typing in the editor.

3) When in the Editor, F3 should search again for the current string. You have it opening the Find/Replace editor. Shift-F3 should search backwards.

4) The Find dialog doesn't save the previous search strings in a dropdown box (spinner) so I have to retype it all the time. It improves my typing, but slows me down. :)

5) I don't find bookmarks in the editor to be that useful, at least not as useful as in other editors like Delphi. I am used to being able to set a bookmark using Shift-Ctrl-1 and then when I want to go back to that bookmark I press Ctrl-1. That way I can set up my primary bookmarks with low numbers (code locations I use a lot) and higher numbers like 7,8,9 to temporary bookmarks. I can immediately jump to any bookmark I like. But with B4A I have to move through each bookmark looking for the one I want. This is a bit tedious.

Well, that's my 2 cents for today.

Widget


+1 for bookmarks. Coming from Delphi RAD too, the Crtl-K-1, Crtl-K-2, Crtl-K-n to set numbered bookmarks and Crtl-Q-1, Crtl-Q-2, Crtl-Q-n to goto relevant bookmarks is time saver. This works the same in Notepad++

+1 for the Find Dialog. Pressing F3 to "search again" should not pop up the find dialog as well, as it is not needed.

Also multi-line remark would be better to work with the remark character, that is ' rather than the Ctrl-Q which is some hotkey not too relevant to remarking. I think in every IDE this is the same. The multi-line remarking is done by selecting multiple lines and then press the remark character, ' in case of BASIC. Afterwards pressing again that character removes the initial remark char for every line that has one.
 
Top