How to make the vertical scrollbar follow the data? - scrollbar

In a VC++ 6.0 MFC of mine, I added an EditBox with Vertical Scrollbar, every 10 seconds I am reading data from serial port and I have to display through EditBox(IDC_EDIT1), I done it without any problems.
But one typical problem I am facing which is that, whenever a new data displayed in the EditBox the vertical scrollbar goes up and data remains down, I have to scroll down every time to read the data.
So my question is whenever a new data display in EditBox the vertical scrollbar also has to move down along with the data.
How can i do this?

You will need to send the edit control an EM_SETSEL message with the length of the string as the parameters.

Also if your EditBox is CEdit, you can try following its member functions
void SetSel(
DWORD dwSelection,
BOOL bNoScroll = FALSE
);
void SetSel(
int nStartChar,
int nEndChar,
BOOL bNoScroll = FALSE
);

You can send a message to the control:
SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0);
where hwnd is the handle of your editbox

Related

Hi, I need an algorithm to tell a sprite to change the image when the in-game text finishes appearing (in GameMaker studio 1.4)

I need an algorithm to tell a sprite to end as soon as the text finishes appearing, basically I need to make a cutscene which describes the beginning of a story within the game, but since I'm using gamemaker, I don't know how to do it, can someone help me?
For cutscenes and automated image sequences you usually have some sort of variables, that handle the states and counters for displaying sprite's sub-images.
But firstly I like to use mainly two main time-related variables in my controller object usually named sys (counter and counterTime):
c = 0; // and for stepEvent: c += 1; // so it goes +1 per step
ct = 0; // and for stepEvent: ct+= 1 / room_speed; // so it goes +1 per second
During the cutscene you might want to stop everything else that moves:
is_cutscene = false; // objects might not be able to move when this is true
// you still have to implement that by yourself
// player can't move if is_cutscene, nothing happens!!
(except cutscene buttons etc...)
So now when the player gets to a 'cutscene'y object and triggers some cutscene_1 = true eg. you can have the image/text/sound/animation object come to life/create/active... That object might have in the create event:
duration = 6; // 6 seconds the scene lasts
start_time = sys.ct // and in Step: if sys.ct > (start_time + duration)
// then -> cutscene advance/destroy
Ofcourse - this is super simple and now you could only say implement:
walk close to a pop-up object
show an image for 6 seconds
it dissappears
And it might not be big trouble to implement it... BUT THIS may also be the foundation for more advanced multi-step sequence and cuts.

code line lcd.scrollDisplayLeft (); no working

I use the library "LiquidCrystal_I2C.h" and "Wire.h".
The code line lcd.scrollDisplayLeft (); does not run the function.
Do I need to put this before / after the Lcd.print?
Should I put in after delay?
Is it related to the library?
It's just part of the code
lcd.clear;
lcd.scrollDisplayLeft();
lcd.print("press Up to set turn on");
lcd.setCursor(0, 1);
lcd.print("press down to set turn off");
Setting = true;
Thank you!
From https://www.arduino.cc/en/Reference/LiquidCrystalScrollDisplayLeft
Description Scrolls the contents of the display (text and cursor) one
space to the left.
So you clear the LCD, then you scroll an empty LCD 1 space to the left and then you print something. I don't know what happens after as you did not show your entire code.
I don't know how the LCD behaves. Either the scroll is ignored if there is no content or you do not recognize the 1 space change.
In most examples I've seen, this function is used in a loop. Your question suggests, that you did not consult the reference manual.

XPages datagrid not exiting from edit mode

I use dojo.grid.datagrid
If the DataGrid contains lots of rows(example 200) and to scroll, it does not work exit from edit mode cell. Do know what the problem is?
upd: Or maybe someone knows how to use dgrid / gridx in xPages, becouse i found next big bug - encoding after save rest service :(
I just did some testing and I believe I'm seeing the same thing. It seems to be fine to edit and save as I move through the grid. I can scroll down as needed and save changes. However, when I scroll back up and put a cell in edit mode, it doesn't save the changes -- it immediately reverts to the original value. And sometimes it just leaves the cell in edit mode.
I would agree that it seems to be an issue with memory management. If I set the rowsPerPage to a number that will keep all rows in memory, it appears (with very limited testing) that I can scroll up and down and make changes and they're all saved.
I don't have a solution at the moment, but what I would suggest in lieu of a perfect solution is to find a way to set rowsPerPage to a number greater than the amount of rows that will be displayed in the grid. If there's too much data for that to be feasible, then the approach I would take is to provide filtering on the grid to keep the maximum number of rows displayed much lower and then it won't be as much of a performance hit to set the rowsPerPage to a sufficient amount.
If I come across a better solution, I'll come back and post it here.
Yeah! I solved it! :) Error in FileStore.js(extlib). Add this on onClientLoad. I change "!!error code"
restViewItemFileService._processResponse = function(requestObject, data) {
this._items.splice(0, this._items.length); // !!error code -> this.close();
this._start = requestObject.start;
//TODO: clear identity?
dojo.forEach(data.items, function(entry, idx) {
var item = {storeRef:this, attributes:entry};
var id = item.attributes[this._identity]
var pending = this._pendings[id]
if(pending) {
for (var s in pending.modAttrs[s]) {
this.item.attributes[s] = pending.modAttrs[s]
}
}
this._byIdentity[id] = item;
this._items.push(item);
}, this);
this._topLevelEntries = data['#toplevelentries'];
this.onData(requestObject, data);
this._finishResponse(requestObject);
}

Adding Removing Columns to Datagrid in Flex with States

I was developing an app that in the first state you choose a date range using dataFields then you press a button to go to another state and generate a datagrid showing an employee list and another scrollable datagrid with its columns generated dynamically having the worked hours for every employee in every date.
The step sequence to get the error message is:
You choose a date range for example: from 01/01/2013 to 01/31/2013
You press generate button (The app change the currentState = "EmployeeList" and all is OK)
You press the back button (you return to initial state and all is OK)
If you change the date range having more days than before date range then all is OK
If you change the date range having less days than before date range then next error is reached
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.controls.dataGridClasses::DataGridBase/http://www.adobe.com/2006/flex/mx/internal::columnHeaderWordWrap()
at mx.controls.dataGridClasses::DataGridItemRenderer/validateProperties()
at mx.managers::LayoutManager/validateClient()
at mx.controls.dataGridClasses::DataGridHeader/updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
and if you google it then some results take to visit apache bug reporting site
https://issues.apache.org/jira/browse/FLEX-22108
And there is no more...
But I found how to solve it!
To solve it first of all I was googling a lot and i looks like no one got this error and I discover that is a Flex Bug reported to Apache. And I was analyzing the original code from DataGrid.as and DataGridColumn.as to think about a possible solution and I was making some tests and nothing work.
What I did and I hope it will be useful to someone
when you click the back button, inside the backbutton_clickEventLister() and before currentState="";
I just set columns array to new Array();
protected function bttnBack_clickEventHandler(event:Event) : void {
// This code line solved it
dtGrdWorkedHours.columns = new Array();
// Make sure of code it before state change stament
currentState = "";
}

Asp.Net Display message instead of loading image for long running process

When i click on button need to display message instead of loading image for long running process.Need to show what is happening in my code behind.Like below stages
Collecting information from database..........
Generating PDF document..............
Sending e-Mail........
Done.
Note:No need to set default time for stages it need to take message from code behind and display.
Please send me any related links.
Thanks in advance.
Check out Easy incremental status updates for long requests
You could easily add a TextBox control and change the Text property by your code behind, in function of what you do.
For example:
private void Loading()
{
txtLoading.Text = "stage1.Collecting information from database";
// PUT CODE TO COLLECT INFORMATION FROM DATABASE HERE
txtLoading.Text += "\r\nstage2.Generating PDF document";
// PUT CODE TO GENERATE PDF DOCUMENT HERE
// ETC ETC
}
Hope it helps :)

Resources