|
Hi,
I am very much new to the csharp. In one application there a List control is present in a grid. I need to drop down the list control(this is sync fusion list control) items and show it with a enter key stroke. Please suggest
|
|
|
|
|
|
Hello community,
how can I get the selected Item of my custom picker?
I'm facing the problem for hours but have no further idea on how to fix it.
I need the selected value after clicking on the DoneBtn.
test = label.Text; delivers the right value sometimes, but mostly not.
Thank you in advance!!
Class PickerRendererIos.cs :
[assembly: ExportRenderer(typeof(MyPickerRenderer), typeof(PickerRendererIos))]
namespace DigitalNatives.iOS
{
public class PickerRendererIos : PickerRenderer, IUIPickerViewDelegate
{
IElementController ElementController => Element as IElementController;
public String test = "";
public PickerRendererIos()
{
}
[Export("pickerView:viewForRow:forComponent:reusingView:")]
public UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
{
UILabel label = new UILabel
{
TextColor = UIColor.Blue,
Text = Element.Items[(int)row].ToString(),
TextAlignment = UITextAlignment.Center,
};
test = label.Text;
Console.WriteLine(Element.Items[(int)row]);
return label;
}
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
if (Control != null)
{
UIPickerView pickerView = (UIPickerView)Control.InputView;
pickerView.WeakDelegate = this;
pickerView.BackgroundColor = UIColor.White;
}
if (e.OldElement != null)
{
var toolbar = (UIToolbar)Control.InputAccessoryView;
var doneBtn = toolbar.Items[1];
doneBtn.Clicked -= DoneBtn_Clicked;
}
if (e.NewElement != null)
{
var text = e.NewElement.SelectedItem;
var toolbar = (UIToolbar)Control.InputAccessoryView;
var doneBtn = toolbar.Items[1];
doneBtn.Clicked += DoneBtn_Clicked;
}
}
void DoneBtn_Clicked(object sender, EventArgs e)
{
Console.WriteLine("Clicked!!!!");
Element.SelectedItem = test;
}
}
}
|
|
|
|
|
ChristopherLeon wrote: delivers the right value sometimes, but mostly not. Add some debug code to your picker to see what values it is dealing with. Use your debugger to step through the code and see what is happening when the result is incorrect.
|
|
|
|
|
I tried a lot of things.
This is the XAML file where the custom picker is defined:
<local:MyPickerRenderer x:Name="PositionPicker" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6" Style="{StaticResource TextBox}" VerticalOptions="Start" SelectedIndexChanged="Handle_SelectedIndexChangedPositionPicker" SelectedItem="{Binding SelectedPosition, Mode=OneWay}">
<local:MyPickerRenderer.Items>
<x:String>element 1</x:String>
<x:String>element 2</x:String>
<x:String>element 3</x:String>
<x:String>element 4</x:String>
<x:String>element 5</x:String>
<x:String>element 6</x:String>
<x:String>element 7</x:String>
<x:String>element 8</x:String>
<x:String>element 9</x:String>
<x:String>element 10</x:String>
<x:String>element 11</x:String>
<x:String>element 12</x:String>
<x:String>element </x:String>
</local:MyPickerRenderer.Items>
</local:MyPickerRenderer>
I think that the method
SelectedIndexChange is overridden by the custom renderer
local:MyPickerRenderer
Is it possible to access this method again?
Actually
SelectedIndexChanged="Handle_SelectedIndexChangedPositionPicker gives no output:
(Code in the associated .cs file)
void Handle_SelectedIndexChangedPositionPicker(object sender, System.EventArgs e)
{
Console.WriteLine(PositionPicker.SelectedItem);
}
|
|
|
|
|
You assign test only in the GetView method. This is the method that is creating your view. Normally, you would change the value in the Selected override.
This space for rent
|
|
|
|
|
I have to convert a word document to HTML in c#.net. The word document contains special characters such as right single quote, hyphen etc. these values come as junk values. so I encoded to UTF-8 format. When converting word document to HTML the HTML code splits the word with special characters and formats ( Eg: if the text is -- It's the time -- then the formatting will be It ' s the time and the output is --
It ' s the time
the formatting gives a space in on either side of ' . how to rectify it.
|
|
|
|
|
With no idea of how your code works, or what HTML it generates from what input, we would have to guess - and that's a poor idea in development!
Knock up a tiny DOCX file that shows the problem, convert it, and show both the input and output files as source, along with the source code you used to convert it. Then we stand a chance of being able to help you!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
WindowsMediaPlayer fullscreen does Not detect keydown's !
From all I could find, the solution is to use win32 API.
Great...
c# - Axwindows media player dectect keydown in full screen mode - Stack Overflow[^]
I find this interesting link but when I try to add ",IMessageFilter" :
public partial class Form16 : Form,IMessageFilter
i get this error: "...does not implement interface member..."
Now what? How to proceed?
Thank you.
|
|
|
|
|
You need to implement
public bool PreFilterMessage(ref Message m)
{
} The link you cite should help you understand the messages you need to handle; also, see: [^].
You're getting down in the plumbing with this: it's liable to be tricky; a given COM component may, or may not, behave like others.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
thank you mister BillWoodruff and HNY2019.
I run over that link you give me too. But now that you specifically mention it, i tried that code and i dont get the error anymore. Thank you very much.
Now it works!
You are so right calling it the plumbing zone. I like it but i have absolutly no clue what it's potential may be and i am unsure if i should pursue it. I mean, i understand its windows operation, it's the core of everything run on windows. It's forms and their controls. But other than this? Can you summarize it for me please? What can be done? what is used for (the most)? I'm refering to win32 COM plumbing thing. I did watched on youtube an entire series of tutorials about this specific subject, and i get a general idea a bit better than before. But i have an idea, i am not good at anything related to this. Can you inspire me? (or not + arguments)
|
|
|
|
|
I'm glad you got some benefit from my response
_Q12_ wrote: Can you summarize it for me please? What can be done? what is used for (the most)? I'm refering to win32 COM plumbing thing All I can say is that the underlying COM stuff we're still using (often, like the built-in WinForms Controls, wrapped in a shiny .NET API, with a GUI stuck on it) involves a lot internal, highly complex, architecture, and heavy use of the lowest level Win OS facilities. Check out the history of COM: Component Object Model - Wikipedia[^].
Whether you should "go deep" into the plumbing ? To really respond to that, I'd need to know a lot more about you, and your goals.
I would recommend you try to achieve fluency in a high-level language, like C#; learn fundamentals you'd need to know in any programming language, and develop practical programming skills; learn concepts of algorithms, design patterns, interfaces, and OOP; study a philosophy of program design and object/inheritance like SOLID: [^]. And, certainly, get competent with JavaScript, HTML, and web-related tools.
best wishes, Bill
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Very competent answer!
hmmm, but in the same time i dont like your answer. Because i want to know what are the possibilities using it. What is used for most of the time? Is it even used anymore? I suppose, all the great softwares, like Visual studio's, 3dsmax, etc they all have at some point some naked plumbing win32 stuff in them that is not possible to make in any other high level languages. I am guessing here, big time. I am asking about all of these. I am not at all pertinent, im just a rookie (with high hopes in a greater, shinier future).
What is your goal? Why did you learn it in the first place? (i dont know if you know it, but if you do...) You can be as philosophical as you please (i am). Or direct as you can. (i do also)
modified 2-Jan-19 7:12am.
|
|
|
|
|
Do you want to learn dinosaur dentistry and be unemployable until Jurassic Park is a reality, or, do you want to be a general practitioner ?
Do you want to build your own car from parts, or fix one that is drive-able now ?
Anything's possible
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Hello,
If You use Visual Studio, when You extends from Interface, You can use Quick Action to implement the interface function.
Click the bulb icon (Ctrl+.), and choose Implement Interface..
[^]
[^]
Interface need to declare interface function(s) at the child, and the parent does not declare yet the body of interface function.
Regards
Toha
|
|
|
|
|
First of all, HNY2019 to codeproject comunity. You are doing a very good job!
I am learning how to use WindowsMediaPlayer control.
My (new) track bar is a fixed length (200px) Empty control with a Paint red rectangle inside it, that updates videoplayer Current time.
I am stuck at a strange point that i cant manage to see the solution.
I bet is a simple solution and i am too tired and foggy to see it right now.
The problem is the Maximum Length of the Movie. It is changing every time when i load a new movie, right so far? Now, my fixed track bar has 200px. How do i make 200px into 1600 int length?
So sorry for my bad english explanation.
Basically, i want to clone a videoPlayer trackbar.
Thank you.
|
|
|
|
|
You're not cloning anything. All you're doing is mapping a number range onto another number range, or a simple percentage. Your trackbar simply goes from 0 to 100%. This is grade school math.
At 200 pixels wide, each pixel represents 0.5%. When your video is playing, you get the percentage played by dividing the number of seconds played by the total number of seconds in the video. You'll get a number between 0 and 1, your percentage played.
|
|
|
|
|
i still dont get it.
put an example there too please.
|
|
|
|
|
It's simple. You played 1200 seconds of a 1600 second video. That's 1200/1600 = 0.75, or 75% of the video played.
Your trackbar is 200 pixels wide, for 100%, so each pixel represents 0.5%, or put another way, 2 pixels represents every 1%. So, you draw your marker 75 * 2 pixels over from it's start.
|
|
|
|
|
Thank you mister Dave Kreskowiak - very nice answer!
|
|
|
|
|
Simple: each pixel in your trackbar represents a variable amount of time: 0.5% of the total length of the movie.
So if your movie is 55 minutes and 37 seconds long, each pixel represents (55 * 60 + 37) * 0.005 == 16.685 seconds.
If your movie is 2 hours, 12 minutes, and 14 seconds long, then each pixel is (((2 * 60) + 12) * 60 + 14) * 0.005 == 39.67 seconds
Get the idea?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
ok i solve it.
I forgot a very old and very useful rule... heh.
All good now. Thank you.
modified 1-Jan-19 13:41pm.
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
another devil now - with progressBarX1_Click.
And...Resolved!
I wish i can Delete this thread. The "delete" link Button from the top, is showing this time(Haleluia), but is greyed out and I can not use it. Probably is a thing for those with money. I am thinking too much probably.
But seriously, this is a ... (my) fart thread, that i wish to smudge it.
modified 1-Jan-19 15:10pm.
|
|
|
|
|
No, it's simply that you can't delete any post with a response: it would leave the response "hanging in midair" with no support, screaming and wetting itself in terror (Posts are scared of heights, as I'm sure you know).
And of course you have no authority to delete other peoples posts, so you can't get rid of it!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|