richedit.pb
Code : Tout sélectionner
supprimer - télécharger l'archive ci-dessus
Code : Tout sélectionner
supprimer - télécharger l'archive ci-dessus
Code : Tout sélectionner
; Windows XP only
; XP Theme enabled in compiler options
XIncludeFile "richedit.pb"
If OpenWindow(0, 0, 0, 320, 240, "EditorGadgetXP", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
hGad1 = StringGadget(1, 5, 5, 310, 22, "")
hGad2 = StringGadget(2, 5, 30, 310, 22, "")
Edit_SetCueBannerText(hGad1, "Enter constant here")
Edit_SetCueBannerText(hGad2, "Enter function here")
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventType() = 14000
Select EventGadget()
Case 1: Edit_ShowBalloonTip(hGad1, "Find a constant", "Enter the constant here !", #TTI_INFO)
Case 2: Edit_ShowBalloonTip(hGad2, "Find a function", "Enter the function here !", #TTI_INFO)
EndSelect
EndIf
EndSelect
ForEver
EndIf
Code : Tout sélectionner
; Windows XP only
; XP Theme enabled in compiler options
XIncludeFile "richedit.pb"
Macro IsFloat(c)
( ( (c>='0') And (c<='9') ) Or (c='.') )
EndMacro
If OpenWindow(0, 0, 0, 320, 240, "Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
TextGadget(1, 5, 5, 310, 18, "Amount :")
StringGadget(2, 5, 25, 310, 22, "", #PB_Text_Right)
TextGadget(3, 5, 55, 310, 18, "Filename :")
StringGadget(4, 5, 75, 310, 22, "")
EM_SetLimitText(GadgetID(2), 12)
EM_SetLimitText(GadgetID(4), #MAX_PATH)
Edit_SetCueBannerText(GadgetID(2), "<Enter an amount>")
Edit_SetCueBannerText(GadgetID(4), "<Enter a filename>")
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case 2
;// Amount Test
If EventType() = #PB_EventType_Change
curInput2.s = GetGadgetText(2)
EM_GetSel(GadgetID(2), @curPos1, @curPos2)
If curInput2
If IsFloat( Asc(Mid(curInput2, curPos1, 1)) )
If CountString(curInput2, ".") < 2
If Len(curInput2) = 12
Edit_ShowBalloonTip(GadgetID(2), "Field `Amount`", "The maximum number of caracters for an amount is fixed to 12 !", #TTI_INFO)
ElseIf Len(StringField(curInput2, 1, ".")) > 9
Edit_ShowBalloonTip(GadgetID(2), "Field `Amount`", "An amount is usually composed by a maximum of 9 digits before the point !", #TTI_WARNING)
ElseIf Len(StringField(curInput2, 2, ".")) > 2
Edit_ShowBalloonTip(GadgetID(2), "Field `Amount`", "An amount is usually composed by a maximum of 2 digits after the point !", #TTI_WARNING)
EndIf
oldInput2.s = curInput2
Else
Edit_ShowBalloonTip(GadgetID(2), "Field `Amount`", "Only one point is allowed !", #TTI_ERROR)
SetGadgetText(2, oldInput2)
EM_SetSel(GadgetID(2), CurPos1-1, CurPos2-1)
EndIf
Else
Edit_ShowBalloonTip(GadgetID(2), "Field `Amount`", "Allowed caracters : . 0 1 2 3 4 5 6 7 8 9", #TTI_ERROR)
SetGadgetText(2, oldInput2)
EM_SetSel(GadgetID(2), CurPos1-1, CurPos2-1)
EndIf
EndIf
EndIf
Case 4
;// Filename Test
If EventType() = #PB_EventType_Change
curInput4.s = GetGadgetText(4)
EM_GetSel(GadgetID(4), @curPos1, @curPos2)
If curInput4
If CheckFilename(curInput4)
If FindString(curInput4, " ", curPos1)
Edit_ShowBalloonTip(GadgetID(4), "Field `Filename`", "Spaces are allowed but it might cause problem with some program !", #TTI_INFO)
ElseIf Len(curInput4) = #MAX_PATH
Edit_ShowBalloonTip(GadgetID(4), "Field `Filename`", "The maximum number of caracters for a filename is fixed to "+Str(#MAX_PATH)+" !", #TTI_ERROR)
EndIf
oldInput4.s = curInput4
Else
Edit_ShowBalloonTip(GadgetID(4), "Field `Filename`", "Forbidden caracters : / \ : * ? < > | "+Chr(34), #TTI_ERROR)
SetGadgetText(4, oldInput4)
EM_SetSel(GadgetID(4), CurPos1-1, CurPos2-1)
EndIf
EndIf
EndIf
EndSelect
EndSelect
ForEver
EndIf
Code : Tout sélectionner
EnableExplicit
XIncludeFile "richedit.pb"
Procedure myWindowCallback(hWnd.l, uMsg.l, wParam.l, lParam.l)
Protected *pnmh.NMHDR
Protected *link.ENLINK
Protected lResult.l = #PB_ProcessPureBasicEvents
If uMsg = #WM_NOTIFY
*pnmh = lParam
If *pnmh\code = #EN_LINK
*link = lParam
If *link\msg = #WM_LBUTTONUP
RunProgram(Edit_GetTextRange(*pnmh\hWndFrom, *link\chrg\cpMin, *link\chrg\cpMax))
EndIf
EndIf
EndIf
ProcedureReturn lResult
EndProcedure
Define.s txt
txt + "PureBasic v4.00 - Beta 11 (Windows - x86)" + #LF$
txt + "Feel the ..Pure.. Power" + #LF$
txt + "" + #LF$
txt + "Team Members :" + #LF$
txt + "Frederic 'AlphaSND' Laboureur" + #LF$
txt + "Benny 'Berikco' Sels" + #LF$
txt + "Andre Beer" + #LF$
txt + "Timo 'Fr34k' Harter" + #LF$
txt + "" + #LF$
txt + "Former Team Members :" + #LF$
txt + "Richard Andersson" + #LF$
txt + "Danilo Krahn" + #LF$
txt + "" + #LF$
txt + "PureBasic, all the provided tools and components" + #LF$
txt + "are copyrighted (c) 2005 by Fantaisie Software" + #LF$
txt + "" + #LF$
txt + "http://www.purebasic.com" + #LF$
txt + "" + #LF$
txt + "Special thanks to all PureBasic users and beta-testers !" + #LF$
txt + "" + #LF$
txt + "Thanks to Gary Willoughby (Kale) for designing the nice" + #LF$
txt + "Toolbar icons for this IDE." + #LF$
txt + "" + #LF$
txt + "Thanks to Neil Hodgson for the scintilla editing" + #LF$
txt + "component." + #LF$
txt + "" + #LF$
txt + "Scintilla is Copyright 1998-2003 by Neil Hodgson" + #LF$
txt + "mailto:neilh@scintilla.org" + #LF$
txt + "" + #LF$
If OpenWindow(0, 0, 0, 400, 300, "About", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
EditorGadget(1, 5, 5, 390, 290, #PB_Text_Center)
EM_SetBkgndColor(GadgetID(1), $DDFFFF)
EM_SetReadOnly(GadgetID(1), #True)
EM_AutourLDetect(GadgetID(1), #True)
EM_SetEventMask(GadgetID(1), EM_GetEventMask(GadgetID(1))|#ENM_LINK)
SetGadgetText(1, txt)
EndIf
SetWindowCallback(@myWindowCallback())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf