PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Remove Maximize, Minimize and exit from MIDI Windows.  (Read 671 times)

andygable

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 4
Remove Maximize, Minimize and exit from MIDI Windows.
« on: February 02, 2017, 05:52:26 PM »

Hi all,

I would like to ask how do i remove the control Menu, Minimize and Maximize and exit buttons from the top of each Midi Window
in FireFly Version 3

Also how do i select a start up module for the system to process? (IE I would like to have a module that would read in some ini settings and then display frmSplash

I hope I have explain myself as good as I could

Thanks for any advice

Andy
Logged

raymw

  • FireFly3 User
  • Junior FireFly Member
  • *
  • Posts: 64
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #1 on: February 02, 2017, 09:00:33 PM »

Hi Andy,
I've not much experience of ff, but if you open the form view, in the property tables, you can alter the Windowstyles (I've no idea what the actual WS_whatevers you need to select/deselect, but you can see the results each produce). In order to run a module, without showing the form, then I'd set the form to invisible when creating it, and run the module, then set the form visible. I expect someone will be along to give you the 'proper answer'.
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8090
  • Windows 10
    • PlanetSquires Software
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #2 on: February 02, 2017, 09:25:50 PM »

I am not sure why you would design an MDI application but then try to have the MDI children windows with no minimize, maximize or close buttons. Seems like an odd design choice? Either way, I will test some code for you and post soon.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8090
  • Windows 10
    • PlanetSquires Software
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #3 on: February 02, 2017, 11:11:58 PM »

Removing the min/max/close buttons for MDI child form in FireFly is proving to be more difficult than I thought. The styles always appear when the project is run no matter if I remove the styles at design time. I will have to look at this again tomorrow with fresh eyes.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8090
  • Windows 10
    • PlanetSquires Software
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #4 on: February 02, 2017, 11:13:40 PM »

Also how do i select a start up module for the system to process? (IE I would like to have a module that would read in some ini settings and then display frmSplash

You can put that code in FF_WINMAIN (find it in the Explorer under Special Functions).
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

andygable

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 4
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #5 on: February 05, 2017, 10:32:58 PM »

The Reason why I want to remove the min max and exit commands from the windows is the program has
to have a dedicated look (as it is a mission critical program and I do not want people just to exit the app with out saving data to the system first)

The app is currently being designed in VB.net (but that is taking up so much RAM on the machines it is not funny any more) I want to move the VB application into FreeBASIC for Windows as it is so much lighter to run then the vb.net version it also means one less Microsoft product on my Windows PC (wish FireFly could make forms for Linux as well that would be awesome if it could but it uses a lot of the WinAPI)

Also I know this is off topic but do you have any examples of reading data from a MySQL database Server?
Logged

andygable

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 4
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #6 on: February 05, 2017, 11:21:58 PM »

I found what i was looking for.

the option was under the windowStyles

now to workout how to load ini files....
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8090
  • Windows 10
    • PlanetSquires Software
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #7 on: February 05, 2017, 11:48:14 PM »

I tore out some code from an application I wrote a couple of years ago that accessed a MySQL Server database remotely. This code obviously doesn't compile as it is written. It is basically just a collection of related code that should show how to initialize, connect, run queries, ping, close, shutdown.

Code: [Select]
#Include Once "mysql\mysql.bi"

' MySQL connection pointer
Dim Shared gMySQLConn as MYSQL Ptr   

   gMySQLConn = mysql_init(Null)

   LogIt( "Connecting to MySQL server: " & IIf(gLocalMode, "LOCAL MODE", "LIVE MODE") )
   If( mysql_real_connect( gMySQLConn, _
                           server, username, password, database, _
                           MYSQL_PORT, Null, 0 ) = 0 ) Then
      'st = "Error trying to connect to MySQL database."
      gLogonErrors = gLogonErrors + 1
      st = "Failed Logon Attempt #" & Str(gLogonErrors) & " of 3" & IIf(gLogonErrors = 5, ": Program will now exit.", "")
      LogIt(st): MsgBox(st)
      gMySQLConn = 0
      If gLogonErrors = 3 Then
         FF_CloseForm hWndForm, 0
      Else
         SetFocus HWND_FRMLOGON_TXTPASSWORD
      End If
   Else
      LogIt( "Client info: " & *mysql_get_client_info() )
      LogIt( "Host info:   " & *mysql_get_host_info(gMySQLConn) )
      LogIt( "Server info: " & *mysql_get_server_info(gMySQLConn) )
      LogIt( "Connection:  " & Str(gMySQLConn) )
      FF_CloseForm hWndForm, 1
   End If


   Dim res  as MYSQL_RES Ptr
   Dim row  as MYSQL_ROW
   Dim nRow as Long 
   ReDim fields(Any) as String 

   sql = "DELETE FROM calendar WHERE id <> 0;"
   If mysql_query(gMySQLConn, sql) Then
      st = "MySQL error deleting Calendar data: " & *mysql_error(gMySQLConn)
      HideWaiting(): LogIt(st): MsgBox(st)
      Return False
   End If

   sql = "DELETE FROM mail_events WHERE event_rowid <> 0;"
   If mysql_query(gMySQLConn, sql) Then
      st = "MySQL error deleting Mail_events data: " & *mysql_error(gMySQLConn)
      HideWaiting(): LogIt(st): MsgBox(st)
      Return False
   End If


   sql = "SELECT events.*, artists.*, paintings.*, venues.* " & _
         "FROM events, artists, paintings, venues " & _
         "WHERE artists.artist_id = events.artist_id " & _
         "AND paintings.painting_id = events.painting_id " & _
         "AND venues.venue_id = events.venue_id ORDER BY events.event_date ASC;"

   If mysql_query(gMySQLConn, sql)  Then
      st = "MySQL error retrieving data: " & *mysql_error(gMySQLConn)
      HideWaiting(): LogIt(st): MsgBox(st)
   Else
      res = mysql_use_result(gMySQLConn)
      nRow = 0
      If res Then
         MySQL_LoadFieldNames(res, fields())
               
         Do
            row = mysql_fetch_row(res)
            If row = 0 Then Exit Do

            If Val(MySQL_GetFieldString(row, "event_active", fields()) ) <> 0 Then
               iOrdinal += 1
           
               sArtistname  = MySQL_GetFieldString(row, "artist_name", fields())
               sTicketsLeft = Str( Val(MySQL_GetFieldString(row, "tickets_quantity", fields())) - Val(MySQL_GetFieldString(row, "tickets_sold", fields())) )
         
            End If
           
            nRow += 1
         Loop

         mysql_free_result(res)
      End If
   End If
   

'--------------------------------------------------------------------------------
Function MySQL_LoadFieldNames( ByVal res as MYSQL_RES Ptr, _
                               fields() as String _
                               ) as Long

   If res = 0 Then Exit Function

   Dim nCount as Long
   Dim fd     as MYSQL_FIELD Ptr
   Dim i      as Long
   
   nCount = mysql_num_fields( res )         
   If nCount Then
      ReDim fields(nCount) as String
      For i = 0 To nCount-1
         fd = mysql_fetch_field( res )
         If fd Then fields(i) = *fd->Name
      Next
   End If

   Function = 0
End Function

'--------------------------------------------------------------------------------
Function MySQL_GetFieldString( ByVal row as MYSQL_ROW, _
                               ByRef sFieldName as Const String, _
                               fields() as String _
                               ) as String
   Dim i as Long
   
   If row = 0 Then Exit Function
   
   For i = LBound(fields) To UBound(fields)
      If LCase(sFieldName) = LCase(fields(i)) Then
         Return *row[i]
      End If
   Next

   Function = ""
End Function

'--------------------------------------------------------------------------------
Function sSql( ByVal st as String ) as String
   Function = FF_Replace(st, "'", "''")
End Function

'--------------------------------------------------------------------------------
Function sSafeSql( ByRef sFromString as Const String ) as String
   Dim sToString as String = String( (Len(sFromString) * 2) + 2, 0)
   mysql_escape_string( sToString, sFromString, Len(sFromString) )
   Function = sToString
End Function   

'--------------------------------------------------------------------------------
Function FRMMAIN_WM_DESTROY ( _
                            hWndForm      as HWnd _      ' handle of Form
                            ) as Long
                           
   ' Close the database
   If gMySQLConn Then
      mysql_close(gMySQLConn)
      LogIt( "MySQL connection closed." )
      gMySQLConn = 0
   End If
   
   Function = 0   ' change according to your needs
End Function

'--------------------------------------------------------------------------------
Function FRMMAIN_TIMER1_WM_TIMER ( _
                                 hWndForm      as HWnd, _     ' handle of Form
                                 wTimerID      as Long  _  ' the timer identifier
                                 ) as Long

   ' Ping the MySQL server to keep our connection alive
   If gMySQLConn = 0 Then Exit Function
   
   ' Timer set to fire this pinq every 10 seconds
   mysql_ping(gMySQLConn)
   
   Function = 0   ' change according to your needs
End Function

Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8090
  • Windows 10
    • PlanetSquires Software
Re: Remove Maximize, Minimize and exit from MIDI Windows.
« Reply #8 on: February 06, 2017, 12:14:23 AM »

I found what i was looking for.

the option was under the windowStyles

now to workout how to load ini files....

Are you sure they were MDI child windows? I couldn't seem to remove them using the window styles. If they were just regular popup windows then no problem. I haven't built an MDI application is years. Even Microsoft doesn't recommend MDI applications anymore.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor