Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/TransparentTextFields
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/TransparentTextFields
This example is the version from Sun, 17th Mar 2012.
Project "TransparentTextFields.rbp"
Class App Inherits Application
Const kEditClear = "Effacer"
Const kFileQuit = "Quitter"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetCocoa then MsgBox "Please compile with cocoa target." end if End EventHandler
End Class
Class Window1 Inherits Window
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
EventHandler Sub Open() // make it transparent Me.NSTextFieldMBS.Bordered=False Me.NSTextFieldMBS.drawsBackground=False // optional Me.NSTextFieldMBS.focusRingType=NSTextFieldMBS.NSFocusRingTypeNone End EventHandler
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
EventHandler Sub Open() dim t as NSTextViewMBS = me.NSTextViewMBS // make it transparent Me.NSScrollViewMBS.drawsBackground=False t.drawsBackground=False // optional t.focusRingType=NSTextFieldMBS.NSFocusRingTypeNone Me.StyledText.Bold( 0,23 )=True // Add padding to the TextArea dim nSize As new NSSizeMBS nSize.width=15.0 // Left and right padding nSize.height=15.0 // Top and bottom padding t.TextContainerInset = nSize End EventHandler
End Control
EventHandler Sub Paint(g As Graphics) dim i,h as integer, r,er as Double dim startCol,endCol as Color h=g.Height startCol=&cE9ECF2 endCol=&cD2D8E0 for i=0 to h r = ((h-i)/h) er = (i/h) g.ForeColor = RGB( endCol.Red*er+startCol.Red*r, endCol.Green*er+startCol.Green*r, endCol.Blue*er+startCol.Blue*r ) g.DrawLine 0, i, g.width, i next End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Fichier"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "Edition"
MenuItem EditUndo = "Annuler"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Couper"
MenuItem EditCopy = "&Copier"
MenuItem EditPaste = "Coller"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Tout Sélectionner"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacControls Plugin.




Links
MBS FileMaker Plugins