Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
Hi,
is it possible to set text in the search bar in toolbox dynamically ?
In Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch()
Thanks
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Well... I can suggest a ugly hack Code:
(pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
or you can make some changes in source code: change the visibility of the following classes to public instead internal. internal class ToolStripSearchBar internal class SearchBar in ToolStripSearchBar change the internal SearchBar property to public in PdfToolStripSearch write somthing like this: Code:
public SearchBar SearchBar
{
get
{
return (this.Items["btnSearchBar"] as ToolStripSearchBar).Control as SearchBar;
}
}
and now you can use it like this: Code:
pdfToolStripSearch1.SearchBar.SearchText = "document";
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
thanks for your answer.
When i use your first method i have an error : (System.NullReferenceException)
at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.StopSearch() at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.StartSearch(SearchBar sb, String searchText) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.OnNeedSearch(ToolStripControlHost item, String searchText) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.SearchBar_NeedSearch(Object sender, EventArgs e) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.SearchBar.OnSearch() at Patagames.Pdf.Net.Controls.WinForms.ToolBars.SearchBar._onsearchTimer_Tick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at Planche.App.Main() in C:\Users\9305924K\Desktop\Planche main\Master\Planche\Planche\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
At what point do you call this code? May be at this moment the toolbar does not initialized yet? Edited by user Monday, February 22, 2016 12:32:18 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
I call in the constructor when i get this error. Code: public ToolsFrm(Patagames.Pdf.Net.Controls.WinForms.PdfViewer viewer)
{
Patagames.Pdf.Net.PdfCommon.Initialize();
this.PdfViewer = viewer;
InitializeComponent();
(pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
cpt++;
}
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Try to move it into Form.Shown event handler Code:
private void Form1_Shown(Object sender, EventArgs e)
{
pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
}
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close