Olaan Expert Licensed User Longtime User Dec 1, 2012 #1 Hi all, I have ever used setLeftandRight and setTopandBottom in designer only,I don't know how to use them in coding.I wish to re-location the object. P.S. Please understand my English,if I wrote mistake. Best Regards Theera
Hi all, I have ever used setLeftandRight and setTopandBottom in designer only,I don't know how to use them in coding.I wish to re-location the object. P.S. Please understand my English,if I wrote mistake. Best Regards Theera
S sorex Expert Licensed User Longtime User Dec 1, 2012 #2 Theera, Some of those handy commands are designer script commands only, I wonder why because the precompiler should be able to change a setLeftandRight to setLayout without any problem. So as I mentioned you have this setLayout command to set the left, top, bottom & right (or was it width,height) in 1 single command in the normal activity scripts. I usually place my object on the correct top and change the left (and width if needed) parameter by code since in most cases that's enough to place/center your object to a different sized (width) resolution. Upvote 0
Theera, Some of those handy commands are designer script commands only, I wonder why because the precompiler should be able to change a setLeftandRight to setLayout without any problem. So as I mentioned you have this setLayout command to set the left, top, bottom & right (or was it width,height) in 1 single command in the normal activity scripts. I usually place my object on the correct top and change the left (and width if needed) parameter by code since in most cases that's enough to place/center your object to a different sized (width) resolution.
M Mahares Expert Licensed User Longtime User Dec 1, 2012 #3 Professor Klaus has created a sample with a code module that can use all the designer script functions in code like what Theeera is looking for. See this link for the complete example: http://www.b4x.com/forum/basic4android-updates-questions/23750-autoscale-code-module.html#post137453 Example: Code: Dim B1 as Button Scale.SetLeftAndRight(B1,0,90%x) B1.Text="TEST FOR THEERA IN THAILAND, ASIA" Upvote 0
Professor Klaus has created a sample with a code module that can use all the designer script functions in code like what Theeera is looking for. See this link for the complete example: http://www.b4x.com/forum/basic4android-updates-questions/23750-autoscale-code-module.html#post137453 Example: Code: Dim B1 as Button Scale.SetLeftAndRight(B1,0,90%x) B1.Text="TEST FOR THEERA IN THAILAND, ASIA"
Olaan Expert Licensed User Longtime User Dec 1, 2012 #4 setLayout in coding = setLeftandRight,setTopandBottom in designer? Hi sorex, I wonder that setLayout have in coding,but not have in designer,in another hand, setLeftandRight,setTopandBottom have in designer,but not have in coding. Why not use the same function? Best Regards Theera Last edited: Dec 1, 2012 Upvote 0
setLayout in coding = setLeftandRight,setTopandBottom in designer? Hi sorex, I wonder that setLayout have in coding,but not have in designer,in another hand, setLeftandRight,setTopandBottom have in designer,but not have in coding. Why not use the same function? Best Regards Theera
S sorex Expert Licensed User Longtime User Dec 1, 2012 #5 Indeed, but a workaround is using codemodules that represend those designer command like Mahares said. At the end the code would just be bigger compared to the precomiler supporting them, but it's probably just a few KB. Upvote 0
Indeed, but a workaround is using codemodules that represend those designer command like Mahares said. At the end the code would just be bigger compared to the precomiler supporting them, but it's probably just a few KB.