WinGrid column IntegerWithSpin starting value - ultrawingrid

Below is my C# code:
grid.DisplayLayout.Bands[0].Columns[11].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.IntegerWithSpin;
grid.DisplayLayout.Bands[0].Columns[11].MaskInput = "nnn";
grid.DisplayLayout.Bands[0].Columns[11].MinValue = -99;
grid.DisplayLayout.Bands[0].Columns[11].MaxValue = 99;
The problem here is that on the application, when I press the "UP" arrow to increase the number, it always starts from -99 but I would like it to start from 0.
Meaning when I press the "UP" arrow the value in the column cell should be 1 instead of -98.
Do anyone know how I could solve this problem?

Related

GetKeyBoardState() always shows some keys were pressed even though they were not after randomly pressing keyboard for a while

I am currently learning Go and trying to make a game which allows players to press several buttons at the same time. Right now, my code works for a while, but sometimes when I randomly press, the GetKeyboardState() always records one or more keys as pressed. The weird key only can be released when I press the key again. Then everything goes correctly again.
For example, I randomly press Up, Down, Left, Right, and right shift bottom on the keyboard to control the character in the game. Suddenly, the character always tries to go right and if I press Up or Down arrow, the character will just go to the top right or the bottom right. Only if I press the right arrow button again, the character can stop go right.
I thought maybe the game goes too fast so I limit the fps under 90 but the situation still exists.
Also, I tried to print out the keyboard status and it always shows the weird bottom was pressed when the situation happened even if I did not touch my keyboard.
func GetInput(keyState []uint8, prevKeyState []uint8) []Input {
input := make([]Input, 0)
if keyState[sdl.SCANCODE_UP] != 0 {
input = append(input, Input{Up})
}
...
// Handle Down, Right, Left
if keyState[sdl.SCANCODE_RSHIFT] == 0 && prevKeyState[sdl.SCANCODE_RSHIFT] != 0 {
input = append(input, Input{RShift})
}
if keyState[sdl.SCANCODE_B] == 0 && prevKeyState[sdl.SCANCODE_B] != 0
{
input = append(input, Input{Debug})
}
// something like prevKeyState = keystate
return input
}
How I use it
keyState := sdl.GetKeyboardState()
prevKeyState := make([]uint8, len(keyState))
for {
...
input := ui.GetInput(keyState, prevKeyState)
HandleInput(input, board)
...
}

Visual Basic: Increasing integer every 3 clicks

So my question is pretty much what the title says: how do I get a certain integer to increase by 1 for every three clicks of a button? For example, let's say the integer is 900. I click button1 once, then again, then again, and on the third click the integer changes to 901. How can this be accomplished?
Thanks in advance.
Use a counter that is actually three times larger behind the scene. Start at 2700 instead of 900, and increase the value by one for each click.
When you want to display the value that increases every third click, you divide the counter by three:
displayValue = counter \ 3
Try this maybe this could help or give you idea
Dim click = 0
Dim num = 900
if (click % 3 = 0)
num+=1
else
click+=1
end if

Titanium: How can I manipulate text of row 3 in a tableview?

Say I have a tableview with 10 rows, and inside each row are two labels (labelA and labelB).
If I wanted to change the text of labelB in row 3, what would be the call to do that?
Thanks!!
Found the answer and putting it here for future reference incase anyone else runs into this.
Here is the answer code to my question
tbl.data[0].rows[2].children[1].text
tbl.data[0] = Data for the Tableview
rows[2] = Goto row 3 (rows start at 0)
children[1] = Goto the second child (again the first label would be child 0 and the second would be child 1)
text = the actual text of the label

Switch scrolling direction with shortkey

I currently have an AHK script which switches the scrolling direction of my mouse.
WheelUp::
Send {WheelDown}
Return
WheelDown::
Send {WheelUp}
Return
My colleagues don't like this and use my computer sometimes.
How can I assign a shortkey to switch the scrolling direction?
What I want:
When I press win+z the scrolling direction is changed, when I pres win+z again, the scrolling direction is changed back.
So basically the scrolling direction can be changed when pressing win+z
Is that possible with AHK?
Yes you can modify your hotkeys to have more code.
You will have to use if statements and variables.
Example:
global direction := 1
^s:: ; ctrl + s will launch this code you can modify this to win + z
direction := Mod( direction + 1 , 2 ) ; alternates values of direction between 1 and 0
return
WheelUp::
if(direction)
Send {WheelDown}
else
Send {WheelUp}
Return
; and reverse for wheeldown

C++/CLI multiple buttons maintaining variable value

OK let me explain my problem.
I'm working on a program where I have a button. Clicking it causes the number "1" to appear, then, after that, any further clicks will increment that value until it reaches the value of "9". (It's a string). I wrote this code which declares an int variable to 0 (Yes, this was a mistake but let me continue) then increment it and parse it to string and show it on the button text(This is the code that executes on button click):
private: System::Void a0_Click(System::Object^ sender, System::EventArgs^ e) {
int i = 0;
i++;
a0->Text = i.ToString();
}
However, as you can suspect, I did the foolishness of declaring i with 0 for each button press, so the result was that 1 was the only value showing on the button. The next thing I tried doing, was declaring i as global variable with the value of 0. However, I came to another problem. I have 82 buttons of that kind, and I'm going for the easiest sollution I can find, so sharing the i variable seemed logical,
The next problem was that if I pressed 5 times the first button, the number displayed on it would be "5" however if I pressed another button, the value wouldn't be "1" by default, it would be "6" (The value of the first button incremented by one). Basically it would inherit the value of the first.
Now I'm at a dead end. I have no idea what to do. I tried using i and i2 but I was just chasing my own tail. Is there a very easy solution to this? Keep in mind I've got 82 buttons (Yes I know it's alot) which are by default 0. When I click each one I need it to increment by one, starting from 0. Any ideas?
Notes: OS is Windows XP, IDE is Visual Studio 2010m using windows forms app, C++/CLI. If I forgot to mention anything post in comments and I'll add it.
You can inspect sender to find out what button was clicked.
void anybutton_Click(System::Object^ sender, System::EventArgs^)
{
Button^ btn = dynamic_cast<Button^>(sender); // or safe_cast
int i;
if (System::Int32::TryParse(btn->Text, i)) {
i++;
btn->Text = i.ToString();
}
}

Resources