Can't get Formlib.Minimizebox to work right

N1c0_ds

Active Member
Licensed User
It has been 3 different applications and 3 different levels of failure with Formlib. Here's how my App_Start event is summed up:

B4X:
Sub App_Start
 FrmMain.Show
 FrmLoading.Show 'Loading screen
  FLMain.New1("frmMain",B4PObject(1))
  FLMain.MinimizeBox=True
 FrmLoading.Show
 FrmMain.Focus
End Sub

I also tried closing with
B4X:
FrmLoading.Close
FrmMain.Show
FLMAin.Minimizebox=True
but the 'X' box still acts like a Ok box

And here's what happens when compiled with optimized compile

-FrmLoading doesn't disappear unless I use FrmMain.Show
-I close FrmLoading myself, see FrmMain with a 'X'
-I click the X and the app closes instead of minimizing (both in compile and IDE)


I spent days on this problem, rewrote my entire app, tried everything. It just doesn't work. The same technique makes the loading form disappear when I use it while downloading files but not otherwise. As for the 'X' box, it never works and it makes me mad.:sign0085:
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
It has been 3 different applications and 3 different levels of failure with Formlib. Here's how my App_Start event is summed up:

B4X:
Sub App_Start
 FrmMain.Show
 FrmLoading.Show 'Loading screen
  FLMain.New1("frmMain",B4PObject(1))
  FLMain.MinimizeBox=True
 FrmLoading.Show
 FrmMain.Focus
End Sub

I also tried closing with
B4X:
FrmLoading.Close
FrmMain.Show
FLMAin.Minimizebox=True
but the 'X' box still acts like a Ok box

And here's what happens when compiled with optimized compile

-FrmLoading doesn't disappear unless I use FrmMain.Show
-I close FrmLoading myself, see FrmMain with a 'X'
-I click the X and the app closes instead of minimizing (both in compile and IDE)


I spent days on this problem, rewrote my entire app, tried everything. It just doesn't work. The same technique makes the loading form disappear when I use it while downloading files but not otherwise. As for the 'X' box, it never works and it makes me mad.:sign0085:

I trully DON'T understand your problem..
The sample code you gave alters NOTHING in the normal usage of the form...
B4X:
Sub App_Start
 FrmMain.Show - [COLOR="SeaGreen"]This shows the main form[/COLOR]
 FrmLoading.Show 'Loading screen - [COLOR="seagreen"]This shows a form named FrmLoading[/COLOR]
  FLMain.New1("frmMain",B4PObject(1)) - [COLOR="seagreen"]This associates a Dll Ofbject to the Main Form[/COLOR]
  FLMain.MinimizeBox=True - [COLOR="seagreen"]This Forces the MainForm to have a "MinimizeBox"[/COLOR]
 FrmLoading.Show - [COLOR="seagreen"]This shows the FrmLoading form, that should already be visisble[/COLOR]
 FrmMain.Focus - [COLOR="seagreen"]This Should Not work as You are trying to set the focus to a hidden form...[/COLOR]
End Sub

It would be of great help to us if a piece of code with you problem ocourring could be posted...
 

N1c0_ds

Active Member
Licensed User
My entire app_start code, live and uncensored!

B4X:
Sub App_Start
Screen.New1 'Used to get screen resolution

FrmMain.Show 'Show frmMain first. If it is closed, the application is closed too.

ProgressBar.New1("FrmLoading",79,35,FrmLoading.Width-89,10)
Progressbar.BringToFront
FrmLoading.DrawImage("icon.bmp",5,5)
AddLabel("FrmLoading","LblLoading",79,20,FrmLoading.Width-5,15,"Loading...")
 LblLoading.Color=255,255,255
 
FrmLoading.Show 'Show the "Loading" form
FrmLoading.Refresh

'COMMAND LINE MODE==========================================
'If ArrayLen(args())>0 Then 'Check if there are arguments
'  For Currentarg = 0 To ArrayLen(args())-1
'   If args(Currentarg)="INSTALL" Then
'    CommandLineMode("Install")
'   Else If args(Currentarg)="UPDATEDB" Then
'    CommandLineMode("UpdateDB")
'   Else If args(Currentarg)="GET" Then
'    CommandLineMode("Get")
'   End If
'  Next
'Else 'If there are no commands, launch normally


'FORM PROPERTIES============================================

FLMain.New1("frmMain",B4PObject(1))
FLMain.MinimizeBox=True

FrmList.ForeLayer=True 'To list the applications

Flimage.New1("frmimage",B4PObject(1))
Flimage.FullScreen2(True,True)
FrmImage.ForeLayer=True

FrmInfo.ForeLayer=True
FLInfo.New1("FrmInfo",B4PObject(1))

'SQL LIBRARIES==============================================

SQLConn.New1
SQLRead.New1
SQLCmd.New1("",SQLConn.Value)
If FileExist(AppPath & "\database.gdb") Then
 SQLConn.Open("Data source = " & AppPath & "\database.gdb") 'Open the database
Else
 Msgbox("Database not found") 'REFINE
End If

'CONTROLS===================================================
Notif.New1 'Notification used to show error messages
Notif.InitialDuration=10000

'FRMMAIN

FrmMain.DrawImage("bg.jpg",FrmMain.Width/2-225/2,25)

  FrmMain.Line(0,0,FrmMain.Width,30,cRed,BF) 'Top bar
  FrmMain.Line(0,FrmMain.Height-30,FrmMain.Width,FrmMain.Height,cRed,BF) 'Bottom bar
  FrmMain.DrawString("Gecko Core 3.1",7,0,FrmMain.Height-30,240,FrmMain.Height,cWhite)
  FrmMain.DrawString("Please report bugs at GetGecko.org",7,0,FrmMain.Height-15,240,FrmMain.Height,cWhite)
  
AddTextBox("frmMain","txtSearch",5,2,FrmMain.Width-75,25,"") 'Search box
 TxtSearch.Fontsize=10
 Cmenu.New1
 Cmenu.AddItem("Search")
 Cmenu.AddItem("-")
 Cmenu.AddItem("Copy")
 Cmenu.AddItem("Paste")
 Cmenu.AddItem("-")
 Cmenu.AddItem("Help")
 FlMain.AddContextMenu("txtsearch",Cmenu.Value)

AddButton("frmMain","btnSearch",Frmmain.Width-70,2,65,TxtSearch.Height,"Go") 'Search button
 BtnSearch.Height=Txtsearch.Height
 BtnSearch.Color=cRed
 BtnSearch.FontColor=cWhite
AddTable("frmMain","TblList",0,0,10,10) 'Where SQL data is temporarily loaded
 TblList.Visible=False
 
 
'FRMLIST

FrmList.Line(0,0,FrmList.Width,20,cRed,BF)
FrmList.Line(0,frmlist.height-30,FrmList.Width,FrmList.Height,cRed,BF)
 Limit=Int((FrmMain.Height-(50))/26) 'checking how many records can be shown in the given screen space
 Spaceheight=((FrmMain.Height-50)-(Int(FrmMain.Height-(50))/26)*26)/2+4
Scrollbarlist.New1("frmList",FrmList.Width-20,20,20,FrmList.Height-50,True) 'Create the scrollbar control, 20 pixels wide
Scrollbarlist.Minimum=0 'Minimum value
Scrollbarlist.SmallChange=Limit 
Scrollbarlist.LargeChange=Limit
 
 
'FRMINFO
  
 FrmInfo.Line(0,0,FrmInfo.Width,20,cRed,BF) 'Top bar
 FrmInfo.Line(0,frminfo.height-30,FrmInfo.Width,FrmInfo.Height,cRed,BF) 'Bottom bar

AddPanel("FrmInfo","PanelMain",0,20,FrmInfo.Width,FrmInfo.Height-50) 'The main info panel
 AddPanel("PanelMain","PanelMain2",0,0,PanelMain.Width,1000)
  'Developer
  AddLabel("PanelMain2","LblDev",0,0,PanelMain2.Width,15,"Author")
   FlInfo.SetFontStyle("LblDev",True, False, False, False)
   Flinfo.TextAlignment("LblDev",FlInfo.alCenter)
   LblDev.Color=255,200,200
   LblDev.Fontsize=9
  AddLabel("PanelMain2","LblDev2",0,17,PanelMain2.Width,20,"...")
   Flinfo.TextAlignment("LblDev2",FlInfo.alCenter)
   LblDev2.Color=255,255,255
   LblDev2.Fontsize=12   
  'Updated
  AddLabel("PanelMain2","LblWeb",0,45,PanelMain2.Width,15,"Website")
   FlInfo.SetFontStyle("LblWeb",True, False, False, False)
   Flinfo.TextAlignment("LblWeb",FlInfo.alCenter)
   LblWeb.Color=255,200,200
   LblWeb.Fontsize=9
  AddLabel("PanelMain2","LblWeb2",0,62,PanelMain2.Width,20,"...")
   Flinfo.TextAlignment("LblWeb2",FlInfo.alCenter)
   LblWeb2.Color=255,255,255 
   LblWeb2.Fontsize=12
  'AppID
  AddLabel("PanelMain2","LblAppID",0,90,PanelMain2.Width,15,"AppID")
   FlInfo.SetFontStyle("LblAppID",True, False, False, False)
   Flinfo.TextAlignment("LblAppID",FlInfo.alCenter)
   LblAppID.Color=255,200,200
   LblAppID.Fontsize=9
  AddLabel("PanelMain2","LblAppID2",0,107,PanelMain2.Width,20,"...")
   Flinfo.TextAlignment("LblAppID2",FlInfo.alCenter)
   LblAppID2.Color=255,255,255 
   LblAppID2.Fontsize=12
   
AddPanel("FrmInfo","PanelText",0,20,FrmInfo.Width,FrmInfo.Height-50) 'Description panel
  AddTextBox("PanelText","TxtInfo",5,15,PanelText.Width-5,PanelText.Height-15,"")
  TxtInfo.Multiline=True
  Txtinfo.FontSize=10
   TxtEx.New1("TxtInfo")
   TxtEx.BorderStyle=bsNone
  AddLabel("PanelText","LblDesc",0,0,PanelText.Width,15,"Description")
   FlInfo.SetFontStyle("LblDesc",True, False, False, False)
   Flinfo.TextAlignment("LblDesc",FlInfo.alCenter)
   LblDesc.Color=255,200,200
   LblDesc.Fontsize=9
  PanelText.Visible=False

AddPanel("FrmInfo","PanelPics",0,20,FrmInfo.Width,FrmInfo.Height-50) 'Screenshot preview panel
  obj.New1(False) 'Door library object
  objArray.New1(1) 'Door library objectarray
  Img.New1 'Img is an ImageClass object used to resize pictures to fit the thumb
  AddImage("PanelPics","Thumb",0,15,PanelPics.Width,PanelPics.Height-15) 'The picture preview (not fullscreen)
   Thumb.Color=255,255,255
   Thumb.Mode=cCenterImage
  PanelPics.Visible=False
  AddLabel("Panelpics","LblScreenshot",0,0,PanelText.Width,15,"Screenshot")
   FlInfo.SetFontStyle("LblScreenshot",True, False, False, False)
   Flinfo.TextAlignment("LblScreenshot",FlInfo.alCenter)
   LblScreenshot.Color=255,200,200
   LblScreenshot.Fontsize=9

'FRMIMAGE
AddButton("frmImage","btnClose",FrmMain.Width-100,0,100,20,"Click to close")
 BtnClose.Color=0,0,0
 BtnClose.FontColor=255,255,255
AddImage("frmImage","Screenshot",0,0,Screen.Width,Screen.Height) 'The fullscreen picture
 Screenshot.Color=0,0,0
 Screenshot.Mode=cCenterImage
'===========================================================
'THE END
FrmLoading.Close
FrmMain.Show
FLMain.MinimizeBox=True
End Sub
 

N1c0_ds

Active Member
Licensed User
Well well well... my problem again.

I tried to change some settings on WkTask (excellent program!) and probably checked the wrong checkbox because the application does minimize.

Since I want to make that thread useful, here is some information about formlib:

-In order to show up in the minimized apps, the Text property of the form must not be empty. That's why the Comm Manager doesn't show up on HTC devices.

-In order to activate the minimizebox, the form must be active (right?)
 
Top