I can't redraw my CEikRichTextEditor control in Symbian - symbian

I'm using code below to drag CEikRichTextEditor contents up and down (Scroll) on touch screen devices but the problem is that when I drag the scroll-bar itself (up or down), and then start dragging again (inside the control), the scroll-bar still in its place with no update:
void CAIBookDescribtion::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
static TInt firstpoint;
if(aPointerEvent.iType == TPointerEvent::EButton1Down)
{
firstpoint = aPointerEvent.iPosition.iY;
}
if(aPointerEvent.iType == TPointerEvent::EDrag)
{
if(aPointerEvent.iPosition.iY > firstpoint)
{
iRichText1->TextView()->ScrollDisplayL(TCursorPosition::EFLineUp);
iRichText1->UpdateScrollBarsL();
DrawNow();
iRichText1->DrawNow();
}
else
{
iRichText1->TextView()->ScrollDisplayL(TCursorPosition::EFLineDown);
iRichText1->UpdateScrollBarsL();
DrawNow();
iRichText1->DrawNow();
}
}
}
So how can I refresh (Redraw) the control and its scroll-bar to reflect its contents?
I'm using Symbian C++, S60 5th Ed SDK, Carbide.C++ 2.7, Testing on Nokia E7 (Symbian Anna)
I created the CEikRichTextEditor control using Carbide.C++ 2.7 UI controls.
Best Regards.

Try using the scrollbar frame:
iRichText1->ScrollBarFrame()->DrawScrollBarsNow()
CEikScrollBarFrame, Nokia SDK

Related

ObjectiveC Accessibility API: UnMaximize Window

I’m not sure if I am referring to this correctly, but when I use the word “UnMaximize”, I’m referring to:
When you click on the green button which is third on the top left of a
Chrome Window, it Maximizes the Window. When I use the word
“UnMaximize” above, I’m referring to the behavior that clicks that
button again so that it is no longer in full screen.
(By the way, what is the correct word for this in MacOS Terminology?)
I enjoy using the Easy Move+Resize App. While it can move Windows around, unfortunately, it has no effect on windows that are Maximized. Fortunately, the code is available on Github.
I’m curious if anyone can point me how to UnMaximize a Window using the Accessibility API
Does anyone what is the UnMaximize equivalent to kAXCloseButtonAttribute
I’m using MacOs 10.12 if that helps.
I’m grateful to #Willeke - Willeke for pointing me in the correct direction.
As mentioned in my question, I was looking at the code of the Easy Move+Resize App on GitHub. The problem with this code/app is that it does not work for Windows that are currently Maximized i.e. it tries to move these Windows, but it cannot, because they are fixed. (Note: This only has use and is relevant in a multi-monitor setup.) This app works correctly for Windows that are not Maximized.
Here, I am trying to add code that would UnMaximize a window in order to move it, and then Maximize it again after it has been moved. Obviously, the code below is in the context of this app, but I’m sure would be useful to users in other contexts.
I first added a wasMaximized property to EMRMoveResize.h
//EMRMoveResize.h
#property bool wasMaximized;
Next, I moved to EMRAppDelegate.m where the actual Event Callback code is. It should be noted that we are only concerned with moving i.e. only concerned with the Left Mouse Button. (This app uses the Right Mouse Button for resizing, which is not relavent when the Window has been maximized.) So, we are only concerned with kCGEventLeftMouseDown, kCGEventLeftMouseDragged and finally with kCGEventLeftMouseUp. In pseudo code, I have done something like:
If (LeftMouseDown) {
Find out if Window is Maximized
If (Window is Maximized) {
set the wasMaximized property
Click FullScreen Button to UnMaximize the Window in Order to Move it
}
The Window is now UnMaximized would now move as other windows in the LeftMouseDragged event, which I have not made any changes to. Finally,
If(LeftMouseUp) {
If(wasMaximized value was set) {
Click FullScreen Button again to Maximize the Window (Since it started out as Maximized)
Reset the wasMaximized property
}
}
Now for the snippets of code changes to EMRAppDelegate.m
if (type == kCGEventLeftMouseDown
|| type == kCGEventRightMouseDown) {
//..
//Skipped Unchanged Code
//..
//Find out if Window is Maximized
CFTypeRef TypeRef = nil;
if (AXUIElementCopyAttributeValue((AXUIElementRef)_clickedWindow, CFSTR("AXFullScreen"), &TypeRef)) {
if(Debug) NSLog(#"Could not get wasMaximized Value");
} else {
[moveResize setWasMaximized: CFBooleanGetValue(TypeRef)];
if(Debug) NSLog(CFBooleanGetValue(TypeRef) ? #"Updated Maximized to True" : #"Updated Maximized to False");
}
//Click FullScreen Button to UnMaximize the Window in Order to Move it
if([moveResize wasMaximized]) {
AXUIElementRef buttonRef = nil;
AXUIElementCopyAttributeValue(_clickedWindow, kAXFullScreenButtonAttribute, (CFTypeRef*)&buttonRef);
if(Debug) NSLog(#"buttonRef: %p", buttonRef);
AXUIElementPerformAction(buttonRef, kAXPressAction);
CFRelease(buttonRef);
}
//..
//Skipped Unchanged Code
//..
}
if (type == kCGEventLeftMouseUp
|| type == kCGEventRightMouseUp) {
//..
//Skipped Unchanged Code
//..
//Click FullScreen Button again to Maximize the Window (Since it started out as Maximized)
AXUIElementRef _clickedWindow = [moveResize window];
if([moveResize wasMaximized]) {
AXUIElementRef buttonRef = nil;
AXUIElementCopyAttributeValue(_clickedWindow, kAXFullScreenButtonAttribute, (CFTypeRef*)&buttonRef);
if(Debug) NSLog(#"buttonRef: %p", buttonRef);
AXUIElementPerformAction(buttonRef, kAXPressAction);
CFRelease(buttonRef);
[moveResize setWasMaximized: false];
}
//..
//Skipped Unchanged Code
//..
}
This worked for me. But I'm not an expert in Objective C or MacOS, so if you feel something can be improved, feel free to edit this post.

Windows Phone 8.1 Light theme page with black background

On WP (Windows Runtime App in my case), if we set the app to be running on Light theme, while the transition is performed, we can still see a black background.
Is there any way to avoid that?
For example, in the animation below, you can see that the page animates but before it ends there is a black background still. I'd like to set that to white somehow, but I am not sure how...
(Image from http://jamescroft.co.uk/blog/windows-phone/utilizing-page-transition-animations-in-windows-phone-8-1-apps/#comment-907).
After thinking a little bit on what item could be parent of Page, I turned my attention towards Frame.
This could be solved by setting the BackgroundColor property of the Frame, when it is created, in the OnLaunchedmethod (App.xaml.cs):
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame
{
CacheSize = 1,
Background = new SolidColorBrush(Colors.White)
};
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
... //rest of OnLaunched method
}
Also you have to make sure to set the background of the Frame as well in the OnActivated method, since this will be launched in some cases where e.g. other apps launch URI to your app or Cortana launches the app, etc.

How to handle various view states in Windows 8.1 store app

I have windows 8.0 code and I had handled the UI for ViewStates like Portrait,Landscape, filled and Snapped. But with windows 8.1 a Viewer can move the app into any size. how do i handle the UI in this case. Currently i am doing it like this.
private void QuestionPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
ApplicationViewState currentState = Windows.UI.ViewManagement.ApplicationView.Value;
if (currentState.Equals(ApplicationViewState.Snapped))
{
VisualStateManager.GoToState(this, "Snapped", false);
}
else if (currentState.Equals(ApplicationViewState.FullScreenLandscape))
{
VisualStateManager.GoToState(this, "FullScreenLandscape", false);
}
else if (currentState.Equals(ApplicationViewState.Filled))
{
VisualStateManager.GoToState(this, "Filled", false);
}
else if (currentState.Equals(ApplicationViewState.FullScreenPortrait))
{
VisualStateManager.GoToState(this, "FullScreenPortrait", false);
}
}
Firstly, you need to decide how to categorize your sizes. We decided to go with the following:
Default - landscape full screen.
Portrait - portrait full screen.
Small - snapped/resized to 500 - 683 wide, vertical orientation
Medium - snapped/resized to 684 wide and above, vertical orientation
So basically, the small and medium sizes are a vertical layout, as the height is bigger than the width. When the Medium width becomes larger than its height, then it would be the default landscape size.
We use:DisplayOrientations CurrentOrientation = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().CurrentOrientation; instead of ApplicationViewState for SizeChangedEventArgs.
Then define the sizes as follows:
//Small Size
if (e.NewSize.Width <= 683
&& (CurrentOrientation == DisplayOrientations.Landscape || CurrentOrientation == DisplayOrientations.LandscapeFlipped || CurrentOrientation == DisplayOrientations.None))
You can then play and define which ever sizes you would like.
Instead of basing your layout on ApplicationViewState - make it depend on size and aspect ratio of the window. Think how users would use your app and what layout would work best in these cases. Maybe one layout would be fine or maybe you might want to switch a GridView layout into a ListView one when the window width is smaller than some value - e.g. 500px. Think what's most comfortable to use in these cases. At the very least - test that the layout doesn't fall apart when you resize the app.

Starting with Kinect for Windows - SDK 1.7

I'm starting with Kinect SDK 1.7, using KinectRegion and other controls like KinectTileButton and KinectScrollViewer from the toolkit. My questions are:
How to enable KinectRegion to work with left and right hands?
Does the SDK 1.7 have something ready to work with zooming?
How to detect grip and release?
Any code available on the Internet?
Thank you!
To Enable the Kinect Region :
Import "Microsoft.Kinect.Toolkit.Controls" project into your solution. (Use Add -> Existing Project)
Add Reference of "Microsoft.Kinect.Toolkit.Controls" into your project.
Add KinectRegion into your XAML using this code :
Import/Use "Microsoft.Kinect.Toolkit.Controls" in your xaml.cs file :
using Microsoft.Kinect.Toolkit;
Bind the sensor chooser's current sensor to the KinectRegion :
var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty,
regionSensorBinding);
I don't get what you mean about "zooming". Please give more detail.
To detect hand gripping and hand release, you can add "AddHandPointerGripHandler" and "AddHandPointerGripReleaseHandler" to your KinectRegion. Please take a look to the KinectScrollViewer.cs.
You can explore the code about the hand pointer and stuff from the "Kinect Developer Toolkit Browser App".
As far as I can remember, KinectRegion works with both hand and automatically detects which one is the main one.
The grip and release detection is also automatic on KinectScrollViewer controls.
About the zooming I have no idea.
You'll find good tutorial on Kinect SDK 1.7 Interactions features on this link
Absolutely outstanding course is on the links below:
The first part shows the basic of Kinect SDK
The second part is similiar to firs part, but with use of MS Blend
And the third part is tutorial for interaction stream, where you can get information of both hands.
But if you´d like to use both hand at Kinect region, you have to edit Microsoft.Kinect.Toolkit.Controls -> KinectRegion.cs -> line 1000 (more info in MSDN Blog question)
It helped to me! (I have the same problem)!
For Grip detection is available in kinectRegion -> kinectRegion.HandPointers[idex of hand(0 is left, 1 is right)].IsInGripInteraction - it´s bool - I added some code:
private Skeleton []skeleton;
private void kinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
using (SkeletonFrame sf = e.OpenSkeletonFrame())
{
if (sf != null && this.skeleton != null) // check that a frame is available
{
sf.CopySkeletonDataTo(this.skeleton); // get the skeletal information in this frame
}
}
}
sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
foreach (var sk in skeleton)
{
if (sk.TrackingId == 0) continue;
else
{
if (kinectRegion.HandPointers[0].IsInGripInteraction == true)
{
.......
}
}
}

integrating ZXing barcode reader in symbian

I am trying to integrating ZXing barcode in my symbian application but i its working
only in the UI class but i want to integrate in listbox view so that when i click
list item Zxing has to open. is this possible?
anybody have idea on this?
Do you just want to open zxing camera view when clicking listbox item?
Then you need to catch listbox event
void CCasesContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) {
if ((aEventType == MEikListBoxObserver::EEventEnterKeyPressed)
|| (aEventType == MEikListBoxObserver::EEventItemClicked)) {
TInt currentItem(iListBox->CurrentItemIndex());
// open the zxing view smth like
DeactivateActiveViewL();
CAknViewAppUi::ActivateLocalViewL(TUid::Uid(zxingView));
}
}
To learn more how views work in symbian start from here or there