Scintilla with Dialog

Just starting out? Need help? Post your questions and find answers here.
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

Scintilla with Dialog

Post by RogerTunnicliffe »

This might be an old question but I have searched and cant find it.

I am trying to use Scintilla with Dialog but every time I add it the dialog will no longer load.
I originally created the *.xml using DialogDesignOr but what it produced would not load and it took me a while to figure out it was the Scintilla entry.
Anyone got any clues

Cheers
Roger
User avatar
HeX0R
Addict
Addict
Posts: 1231
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Scintilla with Dialog

Post by HeX0R »

DialogDesign0R produces e.g. this here, which works fine:

Code: Select all

;/-------------------------
;|
;| Names, IDs, Procedures
;|
;| Example Template for Dialog Design0R
;|
;/-------------------------

CompilerIf #PB_Compiler_Version > 609
	UseDialogScintillaGadget()
CompilerEndIf

#DD_WindowCount = 1
#DD_UseExtraStuff = 0

CompilerIf #DD_UseExtraStuff
	XIncludeFile "../v1.86/DD_AddStuff.pbi"
CompilerEndIf


Global Dim DD_WindowNames.s(#DD_WindowCount)

DD_WindowNames(1) = "window_1"


Runtime Enumeration Gadgets
	#scintilla_1
EndEnumeration


Procedure.s GetXMLString()
	Protected XML$

	XML$ + "<?xml version='1.0' encoding='UTF-16'?>"
	XML$ + ""
	XML$ + "<dialogs><!--Created by Dialog Design0R V1.87 => get it from: https://hex0rs.coderbu.de/en/sdm_downloads/dialogdesign0r/-->"
	XML$ + "  <window name='window_1' flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget' text='Test' minwidth='500' minheight='300' xpos='766' ypos='189'>"
	XML$ + "    <vbox>"
	XML$ + "      <scintilla id='#scintilla_1'/>"
	XML$ + "    </vbox>"
	XML$ + "  </window>"
	XML$ + "</dialogs><!--DDesign0R Definition: PureBasic|1|1|1|_|example_with_declares|1-->"
	XML$ + ""

	ProcedureReturn XML$
EndProcedure
;Test it
CompilerIf #PB_Compiler_IsMainFile
	
	CompilerIf Defined(GetXMLString, #PB_Procedure)
		a$ = GetXMLString()
		ParseXML(0, a$)
	CompilerElse
		LoadXML(0, Left(#PB_Compiler_File, Len(#PB_Compiler_File) - 7))
	CompilerEndIf

	If XMLStatus(0) = #PB_XML_Success
		For i = 1 To #DD_WindowCount
			CreateDialog(i)
			CompilerIf #DD_UseExtraStuff
				R = DEX::InitDialog(i, 0, DD_WindowNames(i), 1)
			CompilerElse
				R = OpenXMLDialog(i, 0, DD_WindowNames(i))
			CompilerEndif
			If R
				HideWindow(DialogWindow(i), 0)
				ok = #True
			Else
				Debug DialogError(i)
			EndIf
		Next i
		CompilerIf Defined(PB_OS_Web, #PB_Constant) = 0 Or #PB_Compiler_OS <> #PB_OS_Web
			If ok
				While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
			EndIf
		CompilerEndIf
	Else
		Debug XMLStatus(0)
		Debug XMLError(0)
	EndIf
	CompilerIf #DD_UseExtraStuff
		DEX::DeInit()
	CompilerEndif

CompilerEndif

;(c) HeX0R 2021
You should look at the output of DialogError(), my crystal ball tells me, that you didn't call UseDialogScintillaGadget()
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

Re: Scintilla with Dialog

Post by RogerTunnicliffe »

Your absolutely right. Did not know about that.
I'll give it a shot tomorrow morning.
Thx.

Been using DialogDesignOr most of today. Not a bad piece of work. Probably better than any of the other Form designers I have searched out for Purebasic. Well done man.
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

Re: Scintilla with Dialog

Post by RogerTunnicliffe »

Hi HeXOR

I've tried this morning and of course you were right. UseDialogScintillaGadget() does the trick..

and... the more I use DialogDesignOr and get to know it the more I like it. Really good job man. :D

it seems that Dialog doco is hard to find so I wonder if you could help me...

1]
Is there a way (in DialogDesignOR or just plain Dialog) that I can add text to a menu like you would if you were coding it
ie:- Giving the Shortcut keys
MenuItem(#M_New, "New" + Chr(9) + "Ctrl+N")

2]
Is there a way (in DialogDesignOR or just plain Dialog) that I can add items to a list like you would if you were coding it
AddGadgetItem(ListIcon_2, 02, "Ctrl+Shift+T" +Chr(10)+"Reload CodeTree")

The other problem I am having is with a menu. I have built it in DialogDesignOr and it appears when viewing the window but it does not appear when I run my program. The code produced by DialogDesignOr is:-

Code: Select all

   
   <menu text="MainMenu" name="" id="#M_MainMenu">
      <submenu text="ProjectMenu" id="#M_ProjectMenu">
        <menuitem text="-"/> 
      </submenu>
      <submenu text="File" id="#M_File">
        <menuitem text="New" id="#M_New"/>
        <menuitem text="Save" id="#M_Save"/>
        <menuitem text="SaveAs" id="#M_SaveAs"/>
        <menuitem text="Quit" id="#M_Quit"/>
        <menubar/>
        <menuitem text="Compare Files" id="#M_CompareFiles"/>
      </submenu>
      <submenu text="Tools" id="#M_Tools">
        <menuitem text="Search" id="#M_Search"/>
        <menuitem text="Navigate" id="#M_Navigate"/>
        <menuitem text="Execute" id="#M_Execute"/>
        <menuitem text="Output" id="#M_Output"/>
        <menuitem text="Help" id="#M_Help"/> 
      </submenu>
      <submenu text="Edit" id="#M_Edit">
        <menuitem text="Find" id="#M_Find"/>
        <menuitem text="Find Next" id="#M_FindNext"/>
        <menuitem text="Find Previous" id="#M_FindPrevious"/>
        <menuitem text="Bookmarks" id="#M_Bookmarks"/>
      </submenu>
      <menuitem text="Help" id="#M_Help"/> 
    </menu> 
  </window>
Would much appreciate your help
Cheers
Roger
User avatar
HeX0R
Addict
Addict
Posts: 1231
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Scintilla with Dialog

Post by HeX0R »

A1) No, that's not supported in DD.
A2) PB doesn't support this. The manual says there would be an <item> tag for the treegadgets, but I never found out how to use this, therefore it is not integrated into DD :lol:

Last question:
PBs dialogs do not support menus, statusbars and toolbars!
Which means, all those features depend on a "hack", which is part of DDs source codes (called DD_AddStuff.pbi) or here in the board.
PB ignores those xml tags, only when using additionally the include from above, they will be shown.

When you are looking for documentation of dialogs in PB, all is hidden in one page, the OpenXMLDialog() help page.
RogerTunnicliffe
User
User
Posts: 24
Joined: Fri Oct 17, 2025 10:10 pm

Re: Scintilla with Dialog

Post by RogerTunnicliffe »

Thx HeXOR

It's a shame that stuff is not supported. I shall press on regardless.

Cheers
Roger
Post Reply