FireFly Visual Designer for FreeBASIC (Updated March 8, 2016)

User projects written in or related to FreeBASIC.
Post Reply
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

PaulSquires wrote:Hi Guys,

I have no problem changing part or all of the site. I remember using the graphics, etc, in order to keep a consistent look and feel with the main FB site in order to build larger brand FB awareness. Looking at it now I can see how it can easily be interpreted as misrepresentative/misleading. I'll rework the site a bit to make it less confusing. I was just wanting to promote the compiler more and give another avenue for internet users at large to be able to access the product. If people use Firefly then that's okay as well. I get nothing from people using the software.

No worries, I'll look at the stuff over the weekend and rearrange the site.
What I would suggest is to just add a link on the "Copyright" text to a page explaining what's copyrighted and what isn't, and perhaps change the "Copyright" text to "Website copyrighted" or something along those lines.

I understand you're promoting FB, but you want to promote your own product, of course.

Perhaps it's best to remove the copyright notice altogether (just the notice, not the site!) and move your Firefly FB forum to your main site. That way, people interested in the PB version might even try that, or in the future if you want to add some sort of paid portion for the Freebasic Firefly version it'll be simpler to do so.
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

NOOBIE questions

Post by rdhays82604 »

Great job on your editor Paul!

1) I would like to have a popup menu when I right-click on a text box. How can I do this.

2) How do I get the text from a textbox control array?

3) Will you be implementing a "DataGridView" control?
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: NOOBIE questions

Post by PaulSquires »

rdhays82604 wrote:Great job on your editor Paul!

1) I would like to have a popup menu when I right-click on a text box. How can I do this.

2) How do I get the text from a textbox control array?

3) Will you be implementing a "DataGridView" control?
(1) I assume you want the popup in a RichEdit control? (regular TextBoxes should automatically show a popup menu). Here is some PB code that shows what to do. Should be easy to port the code to FB:

Code: Select all

%IDC_RICHEDIT_UNDO  = %WM_USER + 101
%IDC_RICHEDIT_CUT   = %WM_USER + 102
%IDC_RICHEDIT_COPY  = %WM_USER + 103
%IDC_RICHEDIT_PASTE = %WM_USER + 104

'//
'//  Create and show the right-click popup menu for the RichEdit textboxes
'//
Function ShowRichEditPopup() As Long

    If g.hRightClickPopup Then DestroyMenu g.hRightClickPopup

    g.hRightClickPopup = CreatePopupMenu()
        AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_UNDO,  "Undo"
        AppendMenu g.hRightClickPopup, %MF_SEPARATOR, 0, ""
        AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_CUT,   "Cut"
        AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_COPY,  "Copy"
        AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_PASTE, "Paste"
        
End Function


'--------------------------------------------------------------------------------
Function FRMPROJNOTES_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

   Select Case wMsg
      Case %WM_CONTEXTMENU
          ShowRichEditPopup
          Local pt As PointApi
          GetCursorPos pt
          TrackPopupMenu g.hRightClickPopup, %TPM_LEFTALIGN Or _
                              %TPM_LEFTBUTTON, pt.x, _
                              pt.y, 0, hWndForm, ByVal %Null
          
   End Select

End Function


'--------------------------------------------------------------------------------
Function FRMPROJNOTES_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_RICHEDIT_UNDO
         SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %EM_UNDO, 0, 0  
      Case %IDC_RICHEDIT_CUT 
         SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_CUT, 0, 0  
      Case %IDC_RICHEDIT_COPY  
         SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_COPY, 0, 0  
      Case %IDC_RICHEDIT_PASTE 
         SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_PASTE, 0, 0  
      
   End Select

End Function

(2) Code from a textbox control array can be gotten from using the FF_TextBox_GetText function. The first parameter would be the Windows handle of the control. eg. FORM1_TEXTBOX1(0). Notice that the handle is actually an array FORM1_TEXTBOX1(0), FORM1_TEXTBOX1(1), FORM1_TEXTBOX1(2), etc....

If you are trying to get the text from a RichEdit control then you need to deal with the EM_STREAMOUT message. I didn't port my PB version of the FF_RichEdit_GetText function to FB. Not sure why... :) Do a search of this forum for EM_STREAMOUT. There should be examples here.


(3) No plans for a data grid control. Sorry.
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

Post by rdhays82604 »

1) I was refering to the TextBox. Couldn't figure out how to add to the menu.
2) "(n)" That's what I was missin'
3) Awe shucks :( (Looks like ListView is similar to it.)

Another one.
How do I reset the date in the DateTimePicker?
"FF_Control_SetText(hwnd_form3_DateTimePicker1,Date)" didn't do it.
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Post by PaulSquires »

Everything DateTimePicker related can be found here:
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Here is how to set the date range from Jan 1, 2000 to Jan 1, 2005 and to set the current date to Jan 1, 2001.

Code: Select all

 Dim   DateRange(1)     As SYSTEMTIME

    DateRange(0).wYear      = 2000
    DateRange(0).wMonth     = 1
    DateRange(0).wDayOfWeek = 0
    DateRange(0).wDay       = 1
    DateRange(0).wHour      = 0
    DateRange(0).wMinute    = 0
    DateRange(0).wSecond    = 0

    DateRange(1).wYear      = 2005
    DateRange(1).wMonth     = 1
    DateRange(1).wDayOfWeek = 0
    DateRange(1).wDay       = 1
    DateRange(1).wHour      = 23
    DateRange(1).wMinute    = 59
    DateRange(1).wSecond    = 59

    SendMessage hWndControl, %DTM_SETRANGE, %GDTR_MIN Or %GDTR_MAX, ByVal VarPtr(DateRange(0))

    DateRange(0).wYear      = 2001
    DateRange(0).wMonth     = 1
    DateRange(0).wDayOfWeek = 0
    DateRange(0).wDay       = 1
    DateRange(0).wHour      = 0
    DateRange(0).wMinute    = 0
    DateRange(0).wSecond    = 0

    SendMessage hWndControl, %DTM_SETSYSTEMTIME, %GDT_VALID, ByVal VarPtr(DateRange(0))
(sorry, don't have time to translate it to FB)
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

Post by rdhays82604 »

Thanks! :)

Once I got rid of the "%"'s it worked.

Is there a way to add entries to the popup menu for textbox controls?
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Post by PaulSquires »

The following should work. You create your own menu in the WM_CONTEXTMENU handler for the TextBox control, and respond to the selected choices from that menu in the Form's WM_COMMAND handler.

Code: Select all


#Define IDC_POPUPMENU_OPTION1  WM_USER + 100
#Define IDC_POPUPMENU_OPTION2  WM_USER + 101
#Define IDC_POPUPMENU_OPTION3  WM_USER + 102

'--------------------------------------------------------------------------------
Function FORM1_TEXT1_WM_CONTEXTMENU ( _
                                    ControlIndex  As Integer,  _  ' index in Control Array
                                    hWndForm      As HWND, _      ' handle of Form
                                    hWndControl   As HWND, _      ' handle of Control
                                    xPos          As Integer,  _  ' x-coordinate of cursor
                                    yPos          As Integer   _  ' y-coordinate of cursor
                                    ) As Integer

    Static hPopupMenu As Dword
    
    If hPopupMenu Then DestroyMenu hPopupMenu
    
    hPopupMenu = CreatePopupMenu()
      AppendMenu hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION1, "Option1"
      AppendMenu hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION2, "Option2"
      AppendMenu hPopupMenu, MF_SEPARATOR, 0, ""
      AppendMenu hPopupMenu, MF_STRING, IDC_POPUPMENU_OPTION3, "Option3"
    
    TrackPopupMenu hPopupMenu, TPM_LEFTALIGN Or TPM_LEFTBUTTON, xPos, yPos, 0, hWndForm, ByVal 0

    Function = True    ' Prevent the standard Windows Edit control menu from showing
       
End Function


'--------------------------------------------------------------------------------
Function FORM1_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"
   
   End Select
   
End Function
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

Post by rdhays82604 »

Thanks! Again! :)
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

File Picker Control

Post by rdhays82604 »

I would like to create a "FilePicker" control.

Right now I have it implemented with a TextBox control with a CommandButton with a "v" as a caption next to it.
It works, but dosen't look the same.

Looking at the DateTimePicker control it appears to capture the drop-down button of the ComboBox control to call up the MonthCalendar control in a popup window.

How can I capture the drop-down button to call up a file select window.
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

Scroll bar control

Post by rdhays82604 »

I am implementing my own version of a DataGridView control.

I need help programming the LineDown and LineUp controls so that the slider tracks properly.

Here is what I have:

Code: Select all

        Case SB_LineDown
            If p>20 And sp+21 <=p Then
                sp+=1
                FF_ScrollBar_SetPos(hwnd_form5_vscroll1,sp,True)
            Else
                FF_ScrollBar_SetPos(hwnd_form5_vscroll1,p,True)
            
            End If

        Case SB_LineUp
            If sp-1 > 0 Then
                sp-=1
                FF_ScrollBar_SetPos(hwnd_form5_vscroll1,sp,True)
            End If
p is the total number of entries to be displayed
sp is the starting entry of the data to be displayed

When it gets to the last entry or move up from the last entry the scroll bar "jumps" to the bottom or top.

What I need help with is smoothing out the scroll moving one line at a time.
Can anyone lend a hand here?
Thanks in advance.
mrToad
Posts: 434
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Post by mrToad »

PaulSquires, Firefly is brilliant, thank you! I was wondering if it would be possible to use my forms within a OpenGL full-screen setup? Or must the form be popped out separately? I skimmed all the posts in this thread but did not see much about GL, sorry if I missed anything.
rdhays82604
Posts: 14
Joined: May 19, 2011 11:43

Post by rdhays82604 »

I finaly got my scroll bar functions working! :)

Still looking for a way to implement a FilePicker that looks like the DateTimePicker.
Drago
Posts: 116
Joined: Aug 10, 2005 13:15

ListView Edit

Post by Drago »

Dear Paul,

many thanks for FireFly..... it is really great.

I have one problem with ListView :

I set LVS_EditLabels so the User can edit Values.

And with my little WinApi understandings.... I have to send a simple True to accept the changes to the LV_ITEM.... but where and how ?

Code: Select all

Function FRMTEILNEHMER_LISTEDIT_LVN_ENDLABELEDIT ( _
                                                 ControlIndex  As Integer,         _  ' index in Control Array
                                                 hWndForm      As HWND,            _  ' handle of Form
                                                 hWndControl   As HWND,            _  ' handle of Control
                                                 ByVal lpDI    As Long  _  ' pointer to LV_DISPINFO ....changed from LV_DISPINFO Ptr
                                                 ) As Integer
Console "EndEdit"
End Function


'--------------------------------------------------------------------------------
Function FRMTEILNEHMER_LISTEDIT_LVN_ITEMCHANGED ( _
                                                ControlIndex  As Integer,         _  ' index in Control Array
                                                hWndForm      As HWND,            _  ' handle of Form
                                                hWndControl   As HWND,            _  ' handle of Control
                                                ByVal lpNMV   As NM_LISTVIEW Ptr  _  ' pointer to NM_LISTVIEW....added #Define NM_Listview NMListview on AppStart
                                                ) As Integer
Console "ItemChanged"
End Function
Both Functions receive an event....
but now I am lost how to SendMessage the True to the LV_ITEM to accept it.
Drago
Posts: 116
Joined: Aug 10, 2005 13:15

Post by Drago »

buhh... self quote...


but this is my dirty workaround :

Code: Select all

Function FRMTEILNEHMER_LISTEdit_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                              
            xRow = SendMessage( hWndControl, LVM_GETSELECTIONMARK, 0, 0)
            xhwnd = ListView_EditLabel( hWndControl, xRow)
     
End Function




'--------------------------------------------------------------------------------
Function FRMTEILNEHMER_LISTEDIT_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 )
        If xString <>"" Then
            FF_ListView_SetItemText( hWndControl, xRow, 0, xString )
        End If
End Function
but.... if someone knows the offical way to do this. I would be glad.....and can get rid of my shared controlHandle :)
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

using ocx..?

Post by Raddel »

Dear Paul,

How i can using ocx in firefly? is there anyway to inject code in custom control? i have seen in this forum freebasic can using ocx but it seems not to easy, i look at this http://www.freebasic.net/arch/file.php?id=44, using axsuite... i seem would be great if firelfly ide can use ocx as same as vb.. :D

Thank You.
Post Reply