25 GUI controls in 1 single class

(Include Files with PP Macros, Classes and User Controls)

25 GUI controls in 1 single class

Unread postby Gerome » Thu Mar 08, 2007 12:17 am

Hello,

This is a GUI helper Class that supports 25 GUI controls with default style and extended style options :)

Enjoy!

10th of March 2007 :: added more OOP approach, see the attached Zip file below... :)

Now we can use the attached zipped class file this way :
Code: Select all
#Include "Controls.inc"
Dim f As New Form(,,,320, 200)
Dim _
   ID_FRAME1 = f.AddControl( "Frame", "myFrame", ,120, 110, 100, 40 )_
    ID_CTRL1  = f.AddControl( "CommandButton", "&Click me 1"  )_
    ID_CTRL2  = f.AddControl( "CommandButton", "&Click me 2", ,120, 8, 100 )_
    ID_LBL1   = f.AddControl( "Label", "myCmd", ,120, 80, 100 )

   '? ID_LBL1.GetAttr("id")
   '? ID_LBL1.GetAttr("Hwnd")

Begin Events
    Select Case CBMSG
        Case WM_COMMAND
            Select Case CBCTL
                Case ID_CTRL1.Id()
                    MsgBox( Null, "Hello CommandButton1!", ID_CTRL1.ClassName(), 0 )
                Case ID_CTRL2.Id()
                    MsgBox( Null, "Hello CommandButton2!", ID_CTRL2.ClassName(), 0 )
                Case ID_LBL1.Id()
                    MsgBox( Null, "Hello Label1!", ID_LBL1.ClassName(), 0 )
            End select
        Case WM_CLOSE
            ExitProgram(0)
        Case Else
    End Select
End Events


Enjoy!
Attachments
Controls.zip
(2.47 KiB) Downloaded 110 times
Last edited by Gerome on Sat Mar 10, 2007 2:33 am, edited 4 times in total.
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Unread postby jinfante » Thu Mar 08, 2007 12:35 am

thanks gerome
jinfante
FBSL tiny seed
FBSL tiny seed
 
Posts: 14
Joined: Wed Feb 28, 2007 4:32 pm

Unread postby Gerome » Thu Mar 08, 2007 4:08 pm

Hi,

jinfante wrote:thanks gerome


Thanks :)
But, I now need some feedback to know what we need to tweak :)
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Re: 25 GUI controls in 1 single class

Unread postby Gerome » Sat Mar 10, 2007 1:35 am

Last edited by Gerome on Sat Mar 10, 2007 5:52 pm, edited 1 time in total.
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Unread postby taobert » Sat Mar 10, 2007 12:09 pm



result : The selected Attachment does not exist anymore :?:

:?
Bert
User avatar
taobert
FBSL geek
FBSL geek
 
Posts: 318
Joined: Sun Oct 29, 2006 4:22 pm
Location: France (Nord)

Unread postby Gerome » Sat Mar 10, 2007 5:52 pm

taobert wrote:


result : The selected Attachment does not exist anymore :?:

:?
Bert


try http://www.fbsl.net/phpbb2/download.php?id=132 :)
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Unread postby Gerome » Mon Mar 12, 2007 6:31 pm

Hi,

Does anyone has any suggestions/ideas to improve my GUI class?
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Re: 25 GUI controls in 1 single class

Unread postby Goldsmith » Wed Aug 31, 2016 8:28 pm

@Gerome,
Thanks. But it worked after a little tweak. Changed the private to public in control class.
User avatar
Goldsmith
FBSL tiny seed
FBSL tiny seed
 
Posts: 48
Joined: Fri Aug 19, 2016 10:21 am

Re: 25 GUI controls in 1 single class

Unread postby Gerome » Thu Sep 01, 2016 5:02 pm

Hi,

Feel free to repost the whole reworked class :)
Yours,

(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
:: Full SETUP w. HELP 05th of December 2011 ::
http://www.fbsl.net/setup/FBSLv3.exe [full v3.4.10 installation pack]
http://www.fbsl.net/setup/FBSLv3bin.zip [minimal upgrade to v3.4.10]
Laissons les jolies femmes aux hommes sans imagination. / Let us leave pretty women to men without imagination.(M.Proust)
The success is a defeat for the one who does not want to dance any more! (H.F. Thiefaine)
User avatar
Gerome
FBSL Administrator
FBSL Administrator
 
Posts: 3149
Joined: Sat Mar 12, 2005 9:06 pm
Location: Paris -- France

Re: 25 GUI controls in 1 single class

Unread postby Goldsmith » Fri Sep 02, 2016 8:04 am

This is the file i have changed.
OMG, i can't attach anything to here. sorry! So i am adding the code directly

Code: Select all
Class Control
   Public:        ' This is change.
    #Define TBS_AUTOTICKS      1
    #Define DTS_LONGDATEFORMAT 4
    #Define WS_COMMON          WS_CHILD BOr WS_VISIBLE BOr WS_TABSTOP

    Shared %ID_GEN = 999, %hRTF = LoadLibrary("riched20.dll")
    Dim %hWndCurrent = 0, %ID_LOCAL = 0
    Dim $myClassName, $myCaption, %myhWnd, %myLeft, %myTop, %myWidth, %myHeight, %myStyle, %myStyleEx

    Method Hwnd(): Return hWndCurrent: End Method
    Method Id(): Return ID_LOCAL: End Method
    Method Top(): Return myTop: End Method
    Method ClassName(): Return myClassName: End Method
    Method Caption(): Return myCaption: End Method
    Method Left(): Return myLeft: End Method
    Method Width(): Return myWidth: End Method
    Method Height(): Return myHeight: End Method
    Method Style(): Return myStyle: End Method
    Method StyleEx(): Return myStyleEx: End Method

User avatar
Goldsmith
FBSL tiny seed
FBSL tiny seed
 
Posts: 48
Joined: Fri Aug 19, 2016 10:21 am

Re: 25 GUI controls in 1 single class

Unread postby Mike Lobanovsky » Fri Sep 02, 2016 10:52 am

Hehe Vinod,

You're absolutely correct! I think this piece of code is worth a separate hall of anti-fame in the Louvre! :ohmy:

It's got its props and methods all wrong: those that must be Private (e.g. like Initialize() ctor and Terminate() dtor) are somehow exposed as Public, while genuine Public Properties like Width(), Height(), etc. are surprisingly called Methods and implemented as private, i.e. inaccessible from the parent form.

I don't know how this piece of code was supposed to work at all. Probably its author could find some time and correct it? It will still be usable under FBSL v3.5 provided it's fixed to comply with the OOP guidelines.

:tomato:
Mike
"Я старый солдат, мадам, и не знаю слов любви."
"I am an old soldier, ma'am, and I don't know the words of love."
"Je suis un vieux soldat, madame, et je ne connais pas les mots d'amour."
"Ich bin ein alter Soldat, gnädige Frau, und ich weiß nicht die Worte der Liebe."

__________________________________________________________________________________________________________________________________________________
(3.2GHz i5 Core Quad, 8GB RAM / 2 x nVidia GTX 550Ti SLI-bridged, 2GB VRAM)
(x86 Win XP Pro Russian Sp3/x86 Win Vista Ultimate Sp2/x64 Win 7 Ultimate Sp1/Wine in x64 elementaryOS Luna)
User avatar
Mike Lobanovsky
FBSL Administrator
FBSL Administrator
 
Posts: 1824
Joined: Tue Apr 19, 2005 8:22 am
Location: Republic of Belarus


Return to FBSL v3 Reusable Code Modules

Who is online

Users browsing this forum: No registered users and 1 guest

cron