FireFly Visual Designer for FreeBASIC (Updated March 8, 2016)
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Distributing the DLL is optional. The control author decides if he wants to use a DLL or distribute source code that can be compiled directly into the exe. I agree that allowing the use of a static library is a good choice too.
FireFly WM_CLOSE and -Are youe sure- Question
Hello Freebasic + Forum + PlanetSquires!
on the first: many thanks for provide Freebasic and Firefly Visuell Designer!
It is a gift for me (and many other users) to create programs in the easy-way!
...my Question: I am a beginner on Windows-Api and I have a problem...
How can I stop to close my form on the WM_Close event?
eg.:
Function myForm_WM_CLOSE
Messagebox "Are you sure to close the window?"
Case Yes: FF_CloseForm hWndForm 'Realy Close my form/program
Case No: Return 'Return to my program without close the form
End Function
or also possible:
How can I disable the [X] - Click on the right top corner of my form?
Many greetings from germany and thanks for a replay of my question!
FFhex
on the first: many thanks for provide Freebasic and Firefly Visuell Designer!
It is a gift for me (and many other users) to create programs in the easy-way!
...my Question: I am a beginner on Windows-Api and I have a problem...
How can I stop to close my form on the WM_Close event?
eg.:
Function myForm_WM_CLOSE
Messagebox "Are you sure to close the window?"
Case Yes: FF_CloseForm hWndForm 'Realy Close my form/program
Case No: Return 'Return to my program without close the form
End Function
or also possible:
How can I disable the [X] - Click on the right top corner of my form?
Many greetings from germany and thanks for a replay of my question!
FFhex
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi!
You can prevent the WM_CLOSE handler from proceeding by returning a non-zero value from the function.
Function myForm_WM_CLOSE
Messagebox "Are you sure to close the window?"
Case Yes: FF_CloseForm hWndForm 'Realy Close my form/program
Case No: Return -1 'Return to my program without close the form
End Function
Hope that helps,
Paul
You can prevent the WM_CLOSE handler from proceeding by returning a non-zero value from the function.
Function myForm_WM_CLOSE
Messagebox "Are you sure to close the window?"
Case Yes: FF_CloseForm hWndForm 'Realy Close my form/program
Case No: Return -1 'Return to my program without close the form
End Function
Hope that helps,
Paul
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hello Paul,
thank you for your help and the quickly answer!
Return -1 works fine in the WM_CLOSE Function!!!
My best Regards!
FFhex
thank you for your help and the quickly answer!
Return -1 works fine in the WM_CLOSE Function!!!
My best Regards!
FFhex
Re: Right-Click Menu for Listview
Hello again forum & PaulSquires,
the Invoices Example in Firefly with the listview - control is a good thing to display data elements in a tabular way.
Here is a screnshot:

...my Question for today is:
How can I create a right-click menu on the cursor, eg. to delete selected rows
or to edit items eg. 'Amount' in selected rows ?
I send many greetings from Germany,
and I hope to an answer for my problem.
FFhex.
the Invoices Example in Firefly with the listview - control is a good thing to display data elements in a tabular way.
Here is a screnshot:

...my Question for today is:
How can I create a right-click menu on the cursor, eg. to delete selected rows
or to edit items eg. 'Amount' in selected rows ?
I send many greetings from Germany,
and I hope to an answer for my problem.
FFhex.
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi,
You can use code like the following. This creates a popup menu when a row in the ListView is right-clicked.
You can use code like the following. This creates a popup menu when a row in the ListView is right-clicked.
Code: Select all
Const IDC_POPUPMENU_OPTION1 = WM_USER + 100
Const IDC_POPUPMENU_OPTION2 = WM_USER + 101
Const IDC_POPUPMENU_OPTION3 = WM_USER + 102
'--------------------------------------------------------------------------------
Function FRMMAIN_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Static hPopupMenu As HMENU
Select Case wMsg
Case WM_CONTEXTMENU
If wParam = HWND_FRMMAIN_LVWINVOICES Then
If hPopupMenu Then DestroyMenu hPopupMenu
hPopupMenu = CreatePopupMenu()
AppendMenu(hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION1, @"PopupMenu Option1")
AppendMenu(hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION2, @"PopupMenu Option2")
AppendMenu(hPopupMenu, MF_SEPARATOR, 0, Null)
AppendMenu(hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION3, @"PopupMenu Option3")
TrackPopupMenu hPopupMenu, TPM_LEFTALIGN Or TPM_LEFTBUTTON, _
LoWord(lParam), HiWord(lParam), 0, hWndForm, ByVal 0
End If
End Select
End Function
'--------------------------------------------------------------------------------
Function FRMMAIN_WM_COMMAND ( _
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
wNotifyCode As Long, _ ' notification code
wID As Long _ ' item, control, or accelerator identifer
) As Long
Select Case wID
Case IDC_POPUPMENU_OPTION1
Print "option 1 selected"
Case IDC_POPUPMENU_OPTION2
Print "option 2 selected"
Case IDC_POPUPMENU_OPTION3
Print "option 3 selected"
Dim nRowSelected As Integer
nRowSelected = FF_ListView_GetSelectedItem(HWND_FRMMAIN_LVWINVOICES)
Print "Selected Listview row is "; nRowSelected
End Select
End Function
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hello Paul,
many thanks for the answer.
I have try the code, it works fine, and the right-click-menu is great!
But I have a still a little problem:
...when i select only one row in the listview (blue): the nRowSelected - Variable is correct
...when i select multiple rows (more than one, with leftclick and pressed shift or ctrl, eg. you can see it in my screenshot):
the nRowSelected - Variable gives only the 'last selected' row.
Is it possible to get in this case all of the selected rows in an variable - array? eg. nRowSelected (selected rows)
...or much better and simply:
Is it possible to forbid the listview-control the selection of multiple rows, so that I can only select (blue) one row in the control?
thanks and greetings!
FFhex
many thanks for the answer.
I have try the code, it works fine, and the right-click-menu is great!
But I have a still a little problem:
...when i select only one row in the listview (blue): the nRowSelected - Variable is correct
...when i select multiple rows (more than one, with leftclick and pressed shift or ctrl, eg. you can see it in my screenshot):
the nRowSelected - Variable gives only the 'last selected' row.
Is it possible to get in this case all of the selected rows in an variable - array? eg. nRowSelected (selected rows)
...or much better and simply:
Is it possible to forbid the listview-control the selection of multiple rows, so that I can only select (blue) one row in the control?
thanks and greetings!
FFhex
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
You can restrict the ListView to selecting one row by clicking on "(WindowStyles)" and then select the "LVS_SINGLESEL"
If you have multiple rows selected then you would loop through the selected rows this way:
If you have multiple rows selected then you would loop through the selected rows this way:
Code: Select all
Do
lIndex = ListView_GetNextItem (HWND_FORM1_LISTVIEW1, lIndex, LVNI_SELECTED)
If lIndex <> - 1 Then
' Process the selected row however you want
End If
Loop Until lIndex = -1
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hello Paul,
that's what I needed! Great!
many thanks!
nice week + greetings!
FFhex
that's what I needed! Great!
many thanks!
nice week + greetings!
FFhex
create a Linklabel with FireFly
Hello Paul,
sorry if I ask again, but I can not find a solution for the problem:
How can I create a 'Linklabel' with Firefly-GUI? (eg. to call my website)
Can you help me again?
Many greetings thanks in advance!
FFhex.
sorry if I ask again, but I can not find a solution for the problem:
How can I create a 'Linklabel' with Firefly-GUI? (eg. to call my website)
Can you help me again?
Many greetings thanks in advance!
FFhex.
Code: Select all
Function FORM1_LABEL1_STN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idStaticControl As Integer _ ' identifier of static control
) As Integer
' !!! change the cursor:point to cursor:hand (when the mouse is moving over the label text)
'????
'Call my Website
#Include Once "windows.bi"
#Include Once "win/shellapi.bi"
Dim dummy As HINSTANCE
dummy = ShellExecute(0, "open", "http://www.myprivatwebsite.com", "", "", SW_SHOWNORMAL)
'
End Function
Re: create a Linklabel with FireFly
Hello,
I myself have searched again and found the following possibility for a linklabel with cursor:hand in firefly.
Many Greetings!
FFhex
I myself have searched again and found the following possibility for a linklabel with cursor:hand in firefly.
Many Greetings!
FFhex
Code: Select all
#Include Once "windows.bi"
#Include Once "win/shellapi.bi"
'
Function FORM1_LABEL1_STN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idStaticControl As Integer _ ' identifier of static control
) As Integer
'Call my Website when I clicking the Label text
Dim dummy As HINSTANCE
dummy = ShellExecute(0, "open", "http://www.myprivatwebsite.com", "", "", SW_SHOWNORMAL)
End Function
'--------------------------------------------------------------------------------
Function FORM1_LABEL1_WM_MOUSEMOVE ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
MouseFlags As Integer, _ ' virtual keys that are pressed
xPos As Integer, _ ' x-coordinate of cursor
yPos As Integer _ ' y-coordinate of cursor
) As Integer
' !!! change the cursor:point to cursor:hand (when the mouse is moving over the label text)
SetCursor(LoadCursor(Null,IDC_HAND))
End Function
Edit all Subitems in the Listview-Control
Hello Paul,
I hope it goes well.
...Can you help me with this problem?
How can I Edit all the Subitems in the Listview-Control (eg. in the invoices-example: all items in the column "Date","Invoice#", "Customer#","Costomer Name","Amount") by clicking on the subitems-entry?
In the Windows-Style of the Listview-Control I have set: [x] LVS_EDITLABELS.
...Now I no longer know.
Many Greetings!
FFhex.
I hope it goes well.
...Can you help me with this problem?
How can I Edit all the Subitems in the Listview-Control (eg. in the invoices-example: all items in the column "Date","Invoice#", "Customer#","Costomer Name","Amount") by clicking on the subitems-entry?
In the Windows-Style of the Listview-Control I have set: [x] LVS_EDITLABELS.
...Now I no longer know.
Many Greetings!
FFhex.
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi,
There is no easy way to edit subitems in a Listview in report mode. Using LVS_EditLabels style only enables editing of the first item. Most approaches to a solution would be to determine the subitem being double clicked on, create a borderless edit control, and position that control over the subitems rectangle area. You then need to handle the editing to determine when the editing ends so that you can clean everything up and update the listview with the new data. There is a lot involved to this and although I haven't done it myself in FB, I have seen code in another BASIC language that does this.
You are better off using a dedicated grid control instead of an editable listview if you can.
Alternatively, you could catch the double-click on a line (or ENTER keypress) and popup a modal Form to capture the editing data. It may not be as cool looking but it sure would be easier to do.
There is no easy way to edit subitems in a Listview in report mode. Using LVS_EditLabels style only enables editing of the first item. Most approaches to a solution would be to determine the subitem being double clicked on, create a borderless edit control, and position that control over the subitems rectangle area. You then need to handle the editing to determine when the editing ends so that you can clean everything up and update the listview with the new data. There is a lot involved to this and although I haven't done it myself in FB, I have seen code in another BASIC language that does this.
You are better off using a dedicated grid control instead of an editable listview if you can.
Alternatively, you could catch the double-click on a line (or ENTER keypress) and popup a modal Form to capture the editing data. It may not be as cool looking but it sure would be easier to do.
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hello Paul,
many thanks for the replay and the good tips.
The last (alternatively) way is good and I want it even try later.
To go another way I found this , but I dont understand, how to implement it in Firefly.
First, it would completely satisfy me, to edit only the first item with LVS_EDITLABELS.
Here I found this and I tried it out in the invoices-example.
But some things wrong :-(
(when I edit the item-text: the new input is not accepted)
Please can you have a look of the code to resolve this problem?
That would be very nice!
Many thanks!
FFhex.
many thanks for the replay and the good tips.
The last (alternatively) way is good and I want it even try later.
To go another way I found this , but I dont understand, how to implement it in Firefly.
First, it would completely satisfy me, to edit only the first item with LVS_EDITLABELS.
Here I found this and I tried it out in the invoices-example.
But some things wrong :-(
(when I edit the item-text: the new input is not accepted)
Please can you have a look of the code to resolve this problem?
That would be very nice!
Many thanks!
FFhex.
Code: Select all
'--------------------------------------------------------------------------------
Function FRMMAIN_LVWINVOICES_WM_LBUTTONUP ( _
ControlIndex As Integer, _
hWndForm As hWnd, _
hWndControl As hWnd, _
MouseFlags As Integer, _
xPos As Integer, _
yPos As Integer _
) As Integer
Dim As Integer xRow
Dim As hWnd xhwnd '????
xRow = SendMessage( hWndControl, LVM_GETSELECTIONMARK, 0, 0)
xhwnd = ListView_EditLabel( hWndControl, xRow)
End Function
'--------------------------------------------------------------------------------
Function FRMMAIN_LVWINVOICES_LVN_ENDLABELEDIT ( _
ControlIndex As Integer, _
hWndForm As hWnd, _
hWndControl As hWnd, _
ByVal lpDI As Long _
) As Integer
Dim As String xString
Dim As Integer xRow
xRow = SendMessage( hWndControl, LVM_GETSELECTIONMARK, 0, 0)
'xString = FF_Control_GetText( xhwnd ) '????
xString = FF_ListView_GetItemText ( hWndControl, xRow, 0 )
MessageBox (0,xstring,"",0)
If xString <>"" Then
FF_ListView_SetItemText( hWndControl, xRow, 0, xString )
End If
End Function
-
- Posts: 6
- Joined: Apr 11, 2012 17:40
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi, new guy here.
All I need is a thumbs up or down. Is Firefly still supported? It looks like a really cool GUI builder.........
Thanks -John
All I need is a thumbs up or down. Is Firefly still supported? It looks like a really cool GUI builder.........
Thanks -John